automated_api/Dockerfile
lixin 4ac1224694
Some checks failed
continuous-integration/drone/push Build is failing
style(Dockerfile): 添加构建阶段注释
- 在 Dockerfile 中添加了构建阶段的注释,提高了代码的可读性
- 修改了 WORKDIR 指令上方的注释,为构建过程提供了更多上下文信息
2025-01-10 14:58:30 +08:00

35 lines
599 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"]