Skip to content

Commit 6731b1d

Browse files
committed
Ready docker file fullstate for CICD building docker image
1 parent 6a3ee65 commit 6731b1d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
# Stage 1: build the application
2-
FROM nginx:alpine AS build
2+
FROM nginx:alpine AS build-nginx
3+
RUN apk add nodejs npm
4+
COPY . .
5+
RUN npm i
6+
RUN npm run build
37
RUN rm -rf /etc/nginx/conf.d/*
48
COPY nginx.conf /etc/nginx/
5-
RUN npm image
6-
RUN npm run build
79
COPY public /usr/share/nginx/html/
810
EXPOSE 80
911

1012
# Stage 2: final image
1113
FROM alpine:latest
1214
RUN apk add --no-cache nginx && mkdir -p /run/nginx
13-
COPY --from=build /usr/share/nginx/html/ /usr/share/nginx/html/
14-
COPY --from=build /etc/nginx/nginx.conf /etc/nginx/nginx.conf
15+
COPY --from=build-nginx /usr/share/nginx/html/ /usr/share/nginx/html/
16+
COPY --from=build-nginx /etc/nginx/nginx.conf /etc/nginx/nginx.conf
1517
EXPOSE 80
1618
HEALTHCHECK --interval=1s --timeout=3s CMD wget -q -O - http://localhost:80 || exit 1
1719
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)