From f29366330d4e4065dc8273d2bb4f434376703030 Mon Sep 17 00:00:00 2001 From: coolxitech Date: Sun, 14 Dec 2025 13:30:01 +0800 Subject: [PATCH] =?UTF-8?q?build(docker):=20=E4=BC=98=E5=8C=96Docker?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B=E5=B9=B6=E9=85=8D=E7=BD=AE?= =?UTF-8?q?Nginx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 合并RUN指令以减少镜像层数 - 移除不必要的cd和mkdir命令 - 添加Nginx配置文件复制步骤 - 清理HTML目录内容 - 暴露端口80用于Web服务 --- Dockerfile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2563f86..7a326bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,20 @@ FROM node:latest AS builder RUN mkdir -p /workspace - WORKDIR /workspace - RUN npm config set registry https://registry.npmmirror.com - -RUN cd /workspace - RUN git clone https://github.com/setube/ogame-vue-ts.git - RUN mv ./ogame-vue-ts/* . ; rm -rf ./ogame-vue-ts/ -RUN npm install -g pnpm ; pnpm install; pnpm build +RUN npm install -g pnpm ; pnpm install; +RUN pnpm build +# --- 第二阶段:Nginx --- FROM nginx:alpine -RUN rm -rf /usr/share/nginx/html/* +COPY nginx.conf /etc/nginx/nginx.conf +RUN rm -rf /usr/share/nginx/html/* COPY --from=builder /workspace/docs /usr/share/nginx/html EXPOSE 80