automated_api/Dockerfile
lixin c077606fd7
Some checks failed
continuous-integration/drone/push Build is failing
build(Dockerfile): 将 Node.js 版本从 18 升级到 22
- 将构建阶段和运行阶段的 Node.js 版本从 18-alpine 更改为 22-alpine
- 此更新可以利用 Node.js 22 的最新特性和性能改进
2025-01-10 15:02:55 +08:00

35 lines
599 B
Docker

# 构建阶段
FROM node:22-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:22-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"]