Created
February 13, 2019 14:28
-
-
Save wodCZ/d956b59754fb580d38c8a7c040568607 to your computer and use it in GitHub Desktop.
Configuration for SPA frontend in Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:9.8.0-alpine as build | |
WORKDIR /usr/src/app | |
COPY package.json yarn.lock ./ | |
RUN yarn | |
COPY . ./ | |
RUN yarn build | |
FROM nginx:1.13.9-alpine | |
COPY ./nginx.conf /etc/nginx/nginx.conf | |
COPY --from=build /usr/src/app/build /usr/share/nginx/html | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user nginx; | |
worker_processes 1; | |
error_log /dev/stderr warn; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; | |
map $status $loggable { | |
~^[23] 0; | |
default 1; | |
} | |
access_log /dev/stdout main if=$loggable; | |
sendfile on; | |
#tcp_nopush on; | |
keepalive_timeout 65; | |
gzip on; | |
server { | |
listen 80; | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
location /service-worker.js { | |
add_header 'Cache-Control' 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; | |
expires off; | |
proxy_no_cache 1; | |
access_log off; | |
} | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment