Skip to content

Instantly share code, notes, and snippets.

@onlurking
Created June 18, 2020 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onlurking/5b7bce93db596deaa70a7bfcd72faeed to your computer and use it in GitHub Desktop.
Save onlurking/5b7bce93db596deaa70a7bfcd72faeed to your computer and use it in GitHub Desktop.
server {
listen 9000 default_server;
server_name localhost;
location / {
root /var/www/html;
try_files $uri $uri/ /index.html;
}
}
# build stage
FROM node:12.16.1-alpine as build-stage
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json package-lock.json* ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:1.17.8-alpine as production-stage
COPY devops/docker/nginx.conf /etc/nginx/nginx.conf
COPY devops/docker/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage /app/dist /var/www/html
COPY start.sh /usr/local/bin/start.sh
EXPOSE 9000
CMD ["start.sh"]
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile off;
keepalive_timeout 60;
include /etc/nginx/conf.d/*.conf;
# gzip settings
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 32 16k;
gzip_http_version 1.1;
gzip_min_length 250;
gzip_types image/jpeg image/bmp image/svg+xml text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon;
}
#!/usr/bin/env sh
set -e
nginx -g 'daemon off;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment