- 将 Dockerfile 中的 Node.js 镜像从阿里云镜像更新为官方 Node.js 镜像 - 在构建和运行阶段添加 npm 镜像设置,使用国内镜像源 - 更新 .drone.yml 文件,将 Docker 插件镜像改为 plugins/docker
This commit is contained in:
parent
3b0f39e2ba
commit
3d024477f9
@ -4,7 +4,7 @@ name: default
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: registry.cn-hangzhou.aliyuncs.com/library/docker:latest
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
dry_run: true
|
dry_run: true
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
# 构建阶段
|
# 构建阶段
|
||||||
FROM registry.cn-hangzhou.aliyuncs.com/library/node:18-alpine AS builder
|
FROM node:18-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
COPY package-lock.json* .
|
COPY package-lock.json* .
|
||||||
|
|
||||||
|
# 设置npm镜像
|
||||||
RUN npm config set registry https://registry.npmmirror.com/ && \
|
RUN npm config set registry https://registry.npmmirror.com/ && \
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
@ -14,7 +15,7 @@ COPY . .
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# 运行阶段
|
# 运行阶段
|
||||||
FROM registry.cn-hangzhou.aliyuncs.com/library/node:18-alpine
|
FROM node:18-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ COPY --from=builder /app/dist ./dist
|
|||||||
COPY --from=builder /app/package.json .
|
COPY --from=builder /app/package.json .
|
||||||
COPY --from=builder /app/bootstrap.js .
|
COPY --from=builder /app/bootstrap.js .
|
||||||
|
|
||||||
|
# 设置npm镜像
|
||||||
RUN npm config set registry https://registry.npmmirror.com/ && \
|
RUN npm config set registry https://registry.npmmirror.com/ && \
|
||||||
npm install --production
|
npm install --production
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user