Skip to content

Instantly share code, notes, and snippets.

@onlurking
Created November 27, 2019 01:25
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/48e5c8230ab086a8a4292aaf0de37342 to your computer and use it in GitHub Desktop.
Save onlurking/48e5c8230ab086a8a4292aaf0de37342 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;
}
}
version: '3'
services:
web:
build:
context: ./
dockerfile: Dockerfile
ports:
- "9000:9000"
# build stage
FROM node:10.16.3-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:1.17.3-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
EXPOSE 9000
CMD ["nginx", "-g", "daemon off;"]
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment