Initial commit: HealthCarePregnant project documentation and platform
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# PCM 后端生产镜像(多阶段构建)
|
||||
# 1) build:安装全部依赖并编译 TypeScript → dist
|
||||
# 2) runtime:仅保留生产依赖与 dist,非 root 运行
|
||||
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
# 仅保留生产依赖,缩小运行镜像
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
FROM node:20-alpine AS runtime
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
# 拷贝生产依赖与编译产物(归属 node 用户)
|
||||
COPY --from=build --chown=node:node /app/node_modules ./node_modules
|
||||
COPY --from=build --chown=node:node /app/dist ./dist
|
||||
COPY --from=build --chown=node:node /app/package.json ./package.json
|
||||
EXPOSE 3000
|
||||
USER node
|
||||
# busybox wget 做容器健康检查(见 docker-compose.yml)
|
||||
CMD ["node", "dist/main.js"]
|
||||
Reference in New Issue
Block a user