automated_api/Dockerfile
lixin 362c73da34
Some checks failed
continuous-integration/drone/push Build is failing
build: 使用中科大镜像构建 docker 镜像
- 在 .drone.yml 文件中添加中科大 docker 镜像仓库作为镜像源
- 在 Dockerfile 中将 node 基础镜像替换为中科大镜像仓库的版本
- 通过使用中科大的镜像源,提高构建速度和可靠性
2025-01-10 14:47:28 +08:00

35 lines
668 B
Docker

# 构建阶段
FROM docker.mirrors.ustc.edu.cn/library/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 docker.mirrors.ustc.edu.cn/library/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"]