Selaa lähdekoodia

Use multistage build for frontend container

pull/531/head
Guillaume Vincent 4 vuotta sitten
vanhempi
commit
9b35717e4a
4 muutettua tiedostoa jossa 55 lisäystä ja 15 poistoa
  1. +0
    -1
      containers/.env
  2. +0
    -2
      containers/docker-compose.override.yml
  3. +9
    -12
      packages/lesspass-site/Dockerfile
  4. +46
    -0
      packages/lesspass-site/nginx.conf

+ 0
- 1
containers/.env Näytä tiedosto

@@ -10,7 +10,6 @@ DATABASE_HOST=db
DATABASE_PORT=5432
FRONTEND_HOST=www.lesspass.local
FQDN=lesspass.local
REACT_APP_BACKEND_HOST=https://api.lesspass.local
EMAIL=admin@lesspass.local
CRT_PATH=ssl/lesspass.crt
KEY_PATH=ssl/lesspass.key


+ 0
- 2
containers/docker-compose.override.yml Näytä tiedosto

@@ -7,8 +7,6 @@ services:
restart: "no"
build:
context: ./frontend
args:
- REACT_APP_BACKEND_HOST=${REACT_APP_BACKEND_HOST}
webserver:
restart: "no"
build: ./webserver

+ 9
- 12
packages/lesspass-site/Dockerfile Näytä tiedosto

@@ -1,16 +1,13 @@
FROM node:boron-slim

FROM node:lts AS builder
MAINTAINER "LessPass <contact@lesspass.com>"

LABEL name="LessPass Frontend"

RUN mkdir -p /frontend
WORKDIR /frontend

COPY package.json /frontend/
RUN npm install --production

COPY package.json yarn.lock ./
RUN yarn install
COPY . /frontend

EXPOSE 8080
CMD [ "npm", "start" ]
RUN yarn build
FROM nginx:alpine
COPY --from=builder /frontend/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

+ 46
- 0
packages/lesspass-site/nginx.conf Näytä tiedosto

@@ -0,0 +1,46 @@
server {
listen 8080;
server_name frontend;

#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


Ladataan…
Peruuta
Tallenna