From ff61902822949e182045e88d33ba9b6092556c17 Mon Sep 17 00:00:00 2001 From: lujianxin <2458505331@qq.com> Date: Tue, 24 Jun 2025 18:02:14 +0800 Subject: [PATCH] =?UTF-8?q?ci:=E4=BC=98=E5=8C=96=E6=8C=81=E7=BB=AD?= =?UTF-8?q?=E9=9B=86=E6=88=90=E9=83=A8=E7=BD=B2=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 .drone.yml 文件,增加删除和创建 dist 目录的步骤 - 更新 Dockerfile,将 COPY 源目录从 dist 改为 dist/dist-prod - 这些更改提高了部署的可靠性和一致性 --- .drone.yml | 5 ++++- Dockerfile | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 6d16b4d..e0e4fd7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,7 +16,10 @@ steps: # - SASS_BINARY_SITE=https://npm.taobao.org/mirrors/node-sass/ npm install node-sass - npm install - npm run build:prod - - cp -r ./dist /home/app/web/dist + + - rm -rf /home/app/web/dist || true # 如果存在就删除(忽略错误) + - mkdir -p /home/app/web/dist + - cp -r ./dist-prod /home/app/web/dist - cp Dockerfile /home/app/web/Dockerfile - cp docker.sh /home/app/web/docker.sh - cp nginx.conf /home/app/web/nginx.conf diff --git a/Dockerfile b/Dockerfile index 2e0f4b7..cbe0d3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM nginx:latest # 定义作者 MAINTAINER chinasoft # 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面 -COPY dist/ /usr/share/nginx/html/ +COPY dist/dist-prod /usr/share/nginx/html/ COPY ./nginx.conf /etc/nginx/conf.d/default.conf EXPOSE ${innerPort} ENTRYPOINT nginx -g "daemon off;"