From 869fcc8d02454c0aa6b57bf22be0e346ee189a8e Mon Sep 17 00:00:00 2001 From: Mezi Aris Apronny Date: Mon, 7 Mar 2022 23:12:21 +0700 Subject: [PATCH] ci: improve Dockerfile (#371) --- .dockerignore | 1 + .maintain/docker/Dockerfile | 11 +++++++---- {nginx => .maintain/docker/nginx}/conf.d/default.conf | 0 {nginx => .maintain/docker/nginx}/nginx.conf | 8 +------- 4 files changed, 9 insertions(+), 11 deletions(-) rename {nginx => .maintain/docker/nginx}/conf.d/default.conf (100%) rename {nginx => .maintain/docker/nginx}/nginx.conf (96%) diff --git a/.dockerignore b/.dockerignore index 80bf1452..ec31cc79 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ .git .github .maintain +!.maintain/docker/nginx/ diff --git a/.maintain/docker/Dockerfile b/.maintain/docker/Dockerfile index 571c7076..4c3888fa 100644 --- a/.maintain/docker/Dockerfile +++ b/.maintain/docker/Dockerfile @@ -1,5 +1,5 @@ # build stage -FROM node:16.11.1 as build-stage +FROM node:16.11.1 as builder WORKDIR /app COPY package*.json ./ RUN npm ci @@ -7,9 +7,12 @@ COPY . . RUN npm run build # production stage -FROM nginx:stable-alpine as production-stage +FROM nginx:stable-alpine as runner +LABEL network.debio.image.authors="debio.dev@blocksphere.id" +WORKDIR /usr/share/nginx/html +COPY ./.maintain/docker/nginx/nginx.conf /etc/nginx/nginx.conf RUN rm /etc/nginx/conf.d/default.conf -COPY nginx/conf.d/default.conf /etc/nginx/conf.d/ -COPY --from=build-stage /app/dist /usr/share/nginx/html +COPY ./.maintain/docker/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf +COPY --from=builder /app/dist /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"] diff --git a/nginx/conf.d/default.conf b/.maintain/docker/nginx/conf.d/default.conf similarity index 100% rename from nginx/conf.d/default.conf rename to .maintain/docker/nginx/conf.d/default.conf diff --git a/nginx/nginx.conf b/.maintain/docker/nginx/nginx.conf similarity index 96% rename from nginx/nginx.conf rename to .maintain/docker/nginx/nginx.conf index c6451f2e..375e7c4c 100644 --- a/nginx/nginx.conf +++ b/.maintain/docker/nginx/nginx.conf @@ -1,16 +1,13 @@ - user nginx; worker_processes auto; 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; @@ -25,9 +22,6 @@ http { #tcp_nopush on; keepalive_timeout 65; - - #gzip on; - + gzip on; include /etc/nginx/conf.d/*.conf; } -