From 78134404c36368e06f9d58c282ab18896f0335a9 Mon Sep 17 00:00:00 2001 From: willyb321 Date: Thu, 26 Jul 2018 08:33:05 +1000 Subject: [PATCH] prettify nginx, dockerfile updates --- .docker/Dockerfile | 4 +-- .docker/docker-compose.yml | 12 ++++--- .docker/nginx.conf | 65 +++++++++++++++++++++----------------- 3 files changed, 46 insertions(+), 35 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index a325cf68..bb1643b8 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -24,7 +24,6 @@ RUN npm start WORKDIR /src/app/coriolis RUN git fetch --all RUN git reset --hard origin/$BRANCH -RUN rm -rf node_modules/ RUN npm install --no-package-lock RUN npm run build @@ -33,5 +32,6 @@ RUN npm run build FROM nginx:1.13.12-alpine as web COPY nginx.conf /etc/nginx/nginx.conf COPY --from=builder /src/app/coriolis/build /usr/share/nginx/html +WORKDIR /usr/share/nginx/html EXPOSE 80 -CMD ["nginx", "-g", "daemon off;"] +CMD ["nginx", "-c", "/etc/nginx/nginx.conf", "-g", "daemon off;"] diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index 222bbbca..238b20d5 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -5,8 +5,8 @@ services: build: dockerfile: coriolis/.docker/Dockerfile context: ../.. - environment: - BRANCH: master + args: + branch: master restart: always networks: - coriolis_web @@ -22,9 +22,13 @@ services: build: dockerfile: coriolis/.docker/Dockerfile context: ../.. + args: + branch: master restart: always - environment: - BRANCH: feature/docker-deployment + volumes: + - ./nginx.conf:/etc/nginx/nginx.conf + ports: + - 8090:80 networks: - coriolis_web - default diff --git a/.docker/nginx.conf b/.docker/nginx.conf index 37848fa3..17639330 100644 --- a/.docker/nginx.conf +++ b/.docker/nginx.conf @@ -1,38 +1,45 @@ -user nobody; -worker_processes auto; # it will be determinate automatically by the number of core - -error_log /var/log/nginx/error.log warn; -#pid /var/run/nginx.pid; # it permit you to use /etc/init.d/nginx reload|restart|stop|start +worker_processes 1; +user nobody nobody; +error_log /tmp/error.log; +pid /tmp/nginx.pid; events { - worker_connections 1024; + + worker_connections 1024; } http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - sendfile on; - access_log /var/log/nginx/access.log; - keepalive_timeout 3000; - server { - listen 80; - listen [::]:80; - index index.html; + include /etc/nginx/mime.types; + default_type application/octet-stream; + sendfile on; + client_body_temp_path /tmp/client_body; + fastcgi_temp_path /tmp/fastcgi_temp; + proxy_temp_path /tmp/proxy_temp; + scgi_temp_path /tmp/scgi_temp; + uwsgi_temp_path /tmp/uwsgi_temp; + access_log /tmp/access.log; + error_log /tmp/error.log; - server_name localhost; - root /usr/share/nginx/html; + keepalive_timeout 3000; + server { + listen 80; + listen [::]:80; + index index.html; + server_name localhost; + root /usr/share/nginx/html; + autoindex on; - location ~* \.(?:manifest|appcache|html?|xml|json|css|js|map|jpg|jpeg|gif|png|ico|svg|eot|ttf|woff|woff2)$ { - expires -1; - add_header Access-Control-Allow-Origin *; - add_header Access-Control-Allow-Credentials true; - add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; - add_header Access-Control-Allow-Headers 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; - access_log off; - } - location / { - try_files $uri $uri/ /index.html =404; - } - } + location ~* \.(?:manifest|appcache|html?|xml|json|css|js|map|jpg|jpeg|gif|png|ico|svg|eot|ttf|woff|woff2)$ { + expires -1; + add_header Access-Control-Allow-Origin *; + add_header Access-Control-Allow-Credentials true; + add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS'; + add_header Access-Control-Allow-Headers 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type'; + access_log off; + } + location / { + try_files $uri $uri/ /index.html =404; + } + } }