[fix]:[20251208][drone 增加前端工程的cicd 8] #45

Merged
jk_yinzy merged 1 commits from yinzy_dev into main 2025-12-08 17:33:46 +08:00
2 changed files with 7 additions and 4 deletions

View File

@ -179,6 +179,8 @@ steps:
- name: docker_sock
path: /var/run/docker.sock
commands:
- cp /localcache/${DRONE_REPO_NAME}/dist-${DRONE_TAG}.tgz dist.tgz
- ls -lh dist.tgz
- docker info
- docker build -t ${DRONE_REPO_NAME}-frontend:latest -f docker/Dockerfile-frontend .
- docker tag ${DRONE_REPO_NAME}-frontend:latest ${DRONE_REPO_NAME}-frontend:${DRONE_COMMIT_SHA:0:8}

View File

@ -7,12 +7,12 @@ WORKDIR /app
COPY vue-ui/package*.json ./
# 使用国内镜像源并安装依赖
RUN npm config set registry https://registry.npmmirror.com \
&& npm ci --no-audit --no-fund
# RUN npm config set registry https://registry.npmmirror.com \
# && npm ci --no-audit --no-fund
# 复制源码并构建
COPY vue-ui/ .
RUN npm run build
# RUN npm run build
# 运行阶段,使用独立 nginx 镜像
FROM registry.cn-beijing.aliyuncs.com/yinzy/nginx:latest AS runtime
@ -22,7 +22,8 @@ WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
# 拷贝构建产物
COPY --from=builder /app/dist .
# 直接使用构建上下文中的 dist.tgz
ADD dist.tgz .
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]