Skip to content

Commit 84d277b

Browse files
authored
Merge pull request Fechin#625 from yiiman-dev/main
Improve docker build for ready to cicd
2 parents 9019cb1 + 962b062 commit 84d277b

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Dockerfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
# Stage 1: build the application
2-
FROM nginx:alpine AS build
2+
FROM node:19 as build-app
3+
WORKDIR /app
4+
COPY . .
5+
RUN npm i
6+
RUN npm run build
7+
8+
# Stage 2: Build nginx
9+
FROM nginx:alpine AS build-nginx
10+
WORKDIR /usr/share/nginx/html/
11+
COPY --from=build-app /app/public /usr/share/nginx/html/
312
RUN rm -rf /etc/nginx/conf.d/*
413
COPY nginx.conf /etc/nginx/
5-
COPY public /usr/share/nginx/html/
614
EXPOSE 80
715

816
# Stage 2: final image
917
FROM alpine:latest
1018
RUN apk add --no-cache nginx && mkdir -p /run/nginx
11-
COPY --from=build /usr/share/nginx/html/ /usr/share/nginx/html/
12-
COPY --from=build /etc/nginx/nginx.conf /etc/nginx/nginx.conf
19+
COPY --from=build-nginx /usr/share/nginx/html/ /usr/share/nginx/html/
20+
COPY --from=build-nginx /etc/nginx/nginx.conf /etc/nginx/nginx.conf
1321
EXPOSE 80
1422
HEALTHCHECK --interval=1s --timeout=3s CMD wget -q -O - http://localhost:80 || exit 1
1523
CMD ["nginx", "-g", "daemon off;"]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"hexo-server": "^2.0.0",
4545
"markdown-it-abbr": "^1.0.4",
4646
"markdown-it-anchor": "^8.4.1",
47-
"markdown-it-attrs": "^4.1.0",
47+
"markdown-it-attrs": "^4.3.1",
4848
"markdown-it-checkbox": "^1.1.0",
4949
"markdown-it-emoji": "^2.0.0",
5050
"markdown-it-footnote": "^3.0.3",

0 commit comments

Comments
 (0)