automated_api/Dockerfile
lixin 3d024477f9
Some checks failed
continuous-integration/drone/push Build is failing
build: 更新 Docker 镜像并设置 npm 镜像
- 将 Dockerfile 中的 Node.js 镜像从阿里云镜像更新为官方 Node.js 镜像
- 在构建和运行阶段添加 npm 镜像设置,使用国内镜像源
- 更新 .drone.yml 文件,将 Docker 插件镜像改为 plugins/docker
2025-01-10 14:44:51 +08:00

35 lines
598 B
Docker

# 构建阶段
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
COPY . .
RUN npm run build
# 运行阶段
FROM node:18-alpine
WORKDIR /app
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
ENV NODE_ENV=production
ENV PORT=8001
EXPOSE 8001
CMD ["node", "bootstrap.js"]