build: 更新 Docker 镜像并设置 npm 镜像
Some checks failed
continuous-integration/drone/push Build is failing

- 将 Dockerfile 中的 Node.js 镜像从阿里云镜像更新为官方 Node.js 镜像
- 在构建和运行阶段添加 npm 镜像设置,使用国内镜像源
- 更新 .drone.yml 文件,将 Docker 插件镜像改为 plugins/docker
This commit is contained in:
lixin 2025-01-10 14:44:51 +08:00
parent 3b0f39e2ba
commit 3d024477f9
2 changed files with 5 additions and 3 deletions

View File

@ -4,7 +4,7 @@ name: default
steps:
- name: build
image: registry.cn-hangzhou.aliyuncs.com/library/docker:latest
image: plugins/docker
settings:
dockerfile: Dockerfile
dry_run: true

View File

@ -1,11 +1,12 @@
# 构建阶段
FROM registry.cn-hangzhou.aliyuncs.com/library/node:18-alpine AS builder
FROM node:18-alpine AS builder
WORKDIR /app
COPY package.json .
COPY package-lock.json* .
# 设置npm镜像
RUN npm config set registry https://registry.npmmirror.com/ && \
npm install
@ -14,7 +15,7 @@ COPY . .
RUN npm run build
# 运行阶段
FROM registry.cn-hangzhou.aliyuncs.com/library/node:18-alpine
FROM node:18-alpine
WORKDIR /app
@ -22,6 +23,7 @@ COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json .
COPY --from=builder /app/bootstrap.js .
# 设置npm镜像
RUN npm config set registry https://registry.npmmirror.com/ && \
npm install --production