From cd7aaf984a3d0e784186da655943b3c1d0209d36 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:11:00 +0000 Subject: [PATCH 1/5] added build step to docker file, because caprover and some another paas systems cant build docker file --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 6322340..7bc1dab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,8 @@ FROM nginx:alpine AS 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 From 6a3ee658e34fde966fbb6735c90d604d853969b7 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:24:24 +0000 Subject: [PATCH 2/5] Update markdown-it-attr package and prevent crash on building headless tables on markdown contents --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e46adae..3f00e09 100644 --- a/package.json +++ b/package.json @@ -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", 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 3/5] 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;"] From 5e4976412a0c867da159fd457a7c0ec3f95f1869 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:48:16 +0000 Subject: [PATCH 4/5] add workdir to docker for faster build --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index afae74d..c9325b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,6 @@ # Stage 1: build the application FROM nginx:alpine AS build-nginx +WORKDIR /app RUN apk add nodejs npm COPY . . RUN npm i From 962b0622f8d985daeead6df164319b62640ecb9b 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 20:05:09 +0000 Subject: [PATCH 5/5] optimize docker build --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c9325b3..99ba16e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,16 @@ # Stage 1: build the application -FROM nginx:alpine AS build-nginx +FROM node:19 as build-app WORKDIR /app -RUN apk add nodejs npm 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