Merge pull request #625 from yiiman-dev/main

Improve docker build for ready to cicd
This commit is contained in:
Fechin authored and GitHub committed 2024-12-24 09:55:25 +08:00
commit 84d277bcb6
2 files changed
+13 -5

No files matched your search

+12 -4
View File
@@ -1,15 +1,23 @@
# Stage 1: build the application
FROM nginx:alpine AS build
FROM node:19 as build-app
WORKDIR /app
COPY . .
RUN npm i
RUN npm run build
# Stage 2: Build nginx
FROM nginx:alpine AS build-nginx
WORKDIR /usr/share/nginx/html/
COPY --from=build-app /app/public /usr/share/nginx/html/
RUN rm -rf /etc/nginx/conf.d/*
COPY nginx.conf /etc/nginx/
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;"]
+1 -1
View File
@@ -44,7 +44,7 @@
"hexo-server": "^2.0.0",
"markdown-it-abbr": "^1.0.4",
"markdown-it-anchor": "^8.4.1",
"markdown-it-attrs": "^4.1.0",
"markdown-it-attrs": "^4.3.1",
"markdown-it-checkbox": "^1.1.0",
"markdown-it-emoji": "^2.0.0",
"markdown-it-footnote": "^3.0.3",