From 6731b1d562e089d34344ac3e596fa9caf5e1b38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B3=D8=A7=D9=85=D8=A7=D9=86=20=D8=A8=D9=87=D8=B4=D8=AA?= =?UTF-8?q?=DB=8C=D8=A7=D9=86=20=28YiiMan=29?= Date: Mon, 23 Dec 2024 19:26:38 +0000 Subject: [PATCH] Ready docker file fullstate for CICD building docker image --- Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7bc1dab..afae74d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,19 @@ # Stage 1: build the application -FROM nginx:alpine AS build +FROM nginx:alpine AS build-nginx +RUN apk add nodejs npm +COPY . . +RUN npm i +RUN npm run build RUN rm -rf /etc/nginx/conf.d/* COPY nginx.conf /etc/nginx/ -RUN npm image -RUN npm run build COPY public /usr/share/nginx/html/ EXPOSE 80 # Stage 2: final image FROM alpine:latest RUN apk add --no-cache nginx && mkdir -p /run/nginx -COPY --from=build /usr/share/nginx/html/ /usr/share/nginx/html/ -COPY --from=build /etc/nginx/nginx.conf /etc/nginx/nginx.conf +COPY --from=build-nginx /usr/share/nginx/html/ /usr/share/nginx/html/ +COPY --from=build-nginx /etc/nginx/nginx.conf /etc/nginx/nginx.conf EXPOSE 80 HEALTHCHECK --interval=1s --timeout=3s CMD wget -q -O - http://localhost:80 || exit 1 CMD ["nginx", "-g", "daemon off;"]