diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..be73b53 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM node:18-buster-slim as builder + +COPY package.json ./ + +RUN npm install && mkdir /app && mv ./node_modules /app + +WORKDIR /app + +COPY . . + +RUN npm run build + +FROM nginx:1.21.6-alpine AS runtime-image + +COPY nginx/default.conf /etc/nginx/conf.d/ + +RUN rm -rf /usr/share/nginx/html/* + +COPY --from=builder /app/dist /usr/share/nginx/html + +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 0000000..e9ff73b --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,19 @@ +server { + listen 80; + sendfile on; + default_type application/octet-stream; + gzip on; + gzip_http_version 1.1; + gzip_disable "MSIE [1-6]\."; + gzip_min_length 1100; + gzip_vary on; + gzip_proxied expired no-cache no-store private auth; + gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript; + gzip_comp_level 9; + root /usr/share/nginx/html; + location ~* \.(?:css|js|map|jpe?g|gif|png)$ { } + location / { + try_files $uri $uri/ /index.html =404; + } + +}