feat(docker): 重构Monorepo构建 — 支持@genex/common共享包
- docker-compose.yml build context从service目录改为backend根目录 - 所有NestJS Dockerfile改为先构建共享@genex/common包 - 共享包编译后复制到service的node_modules供运行时解析 - 新增backend/.dockerignore减少构建上下文体积 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d146bf0a1f
commit
d48bd3acb9
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Node
|
||||||
|
**/node_modules
|
||||||
|
**/dist
|
||||||
|
**/.env
|
||||||
|
|
||||||
|
# Infrastructure (not needed for service builds)
|
||||||
|
migrations/
|
||||||
|
seeds/
|
||||||
|
kong/
|
||||||
|
|
||||||
|
# Scripts
|
||||||
|
deploy.sh
|
||||||
|
**/deploy.sh
|
||||||
|
|
||||||
|
# Git
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
|
||||||
|
# Go service build artifacts
|
||||||
|
**/tmp
|
||||||
|
**/*.exe
|
||||||
|
|
@ -203,8 +203,8 @@ services:
|
||||||
|
|
||||||
user-service:
|
user-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/user-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/user-service/Dockerfile
|
||||||
container_name: genex-user-service
|
container_name: genex-user-service
|
||||||
ports:
|
ports:
|
||||||
- "3001:3001"
|
- "3001:3001"
|
||||||
|
|
@ -235,8 +235,8 @@ services:
|
||||||
|
|
||||||
issuer-service:
|
issuer-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/issuer-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/issuer-service/Dockerfile
|
||||||
container_name: genex-issuer-service
|
container_name: genex-issuer-service
|
||||||
ports:
|
ports:
|
||||||
- "3002:3002"
|
- "3002:3002"
|
||||||
|
|
@ -264,8 +264,8 @@ services:
|
||||||
|
|
||||||
clearing-service:
|
clearing-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/clearing-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/clearing-service/Dockerfile
|
||||||
container_name: genex-clearing-service
|
container_name: genex-clearing-service
|
||||||
ports:
|
ports:
|
||||||
- "3004:3004"
|
- "3004:3004"
|
||||||
|
|
@ -289,8 +289,8 @@ services:
|
||||||
|
|
||||||
compliance-service:
|
compliance-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/compliance-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/compliance-service/Dockerfile
|
||||||
container_name: genex-compliance-service
|
container_name: genex-compliance-service
|
||||||
ports:
|
ports:
|
||||||
- "3005:3005"
|
- "3005:3005"
|
||||||
|
|
@ -314,8 +314,8 @@ services:
|
||||||
|
|
||||||
notification-service:
|
notification-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/notification-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/notification-service/Dockerfile
|
||||||
container_name: genex-notification-service
|
container_name: genex-notification-service
|
||||||
ports:
|
ports:
|
||||||
- "3008:3008"
|
- "3008:3008"
|
||||||
|
|
@ -342,8 +342,8 @@ services:
|
||||||
|
|
||||||
telemetry-service:
|
telemetry-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/telemetry-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/telemetry-service/Dockerfile
|
||||||
container_name: genex-telemetry-service
|
container_name: genex-telemetry-service
|
||||||
ports:
|
ports:
|
||||||
- "3011:3011"
|
- "3011:3011"
|
||||||
|
|
@ -376,8 +376,8 @@ services:
|
||||||
|
|
||||||
admin-service:
|
admin-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/admin-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/admin-service/Dockerfile
|
||||||
container_name: genex-admin-service
|
container_name: genex-admin-service
|
||||||
ports:
|
ports:
|
||||||
- "3012:3012"
|
- "3012:3012"
|
||||||
|
|
@ -484,8 +484,8 @@ services:
|
||||||
|
|
||||||
auth-service:
|
auth-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/auth-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/auth-service/Dockerfile
|
||||||
container_name: genex-auth-service
|
container_name: genex-auth-service
|
||||||
ports:
|
ports:
|
||||||
- "3010:3010"
|
- "3010:3010"
|
||||||
|
|
@ -521,8 +521,8 @@ services:
|
||||||
|
|
||||||
ai-service:
|
ai-service:
|
||||||
build:
|
build:
|
||||||
context: ./services/ai-service
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: services/ai-service/Dockerfile
|
||||||
container_name: genex-ai-service
|
container_name: genex-ai-service
|
||||||
ports:
|
ports:
|
||||||
- "3006:3006"
|
- "3006:3006"
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/admin-service/package*.json ./services/admin-service/
|
||||||
|
WORKDIR /app/services/admin-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/admin-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/admin-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/admin-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/admin-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3012
|
EXPOSE 3012
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/ai-service/package*.json ./services/ai-service/
|
||||||
|
WORKDIR /app/services/ai-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/ai-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/ai-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/ai-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/ai-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3006
|
EXPOSE 3006
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/auth-service/package*.json ./services/auth-service/
|
||||||
|
WORKDIR /app/services/auth-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/auth-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/auth-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/auth-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/auth-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3010
|
EXPOSE 3010
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/clearing-service/package*.json ./services/clearing-service/
|
||||||
|
WORKDIR /app/services/clearing-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/clearing-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/clearing-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/clearing-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/clearing-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3004
|
EXPOSE 3004
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/compliance-service/package*.json ./services/compliance-service/
|
||||||
|
WORKDIR /app/services/compliance-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/compliance-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/compliance-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/compliance-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/compliance-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3005
|
EXPOSE 3005
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/issuer-service/package*.json ./services/issuer-service/
|
||||||
|
WORKDIR /app/services/issuer-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/issuer-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/issuer-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/issuer-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/issuer-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3002
|
EXPOSE 3002
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/notification-service/package*.json ./services/notification-service/
|
||||||
|
WORKDIR /app/services/notification-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/notification-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/notification-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/notification-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/notification-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3008
|
EXPOSE 3008
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/telemetry-service/package*.json ./services/telemetry-service/
|
||||||
|
WORKDIR /app/services/telemetry-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/telemetry-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/telemetry-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/telemetry-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/telemetry-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3011
|
EXPOSE 3011
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,32 @@
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
|
||||||
|
# Build shared @genex/common package
|
||||||
|
COPY packages/common/package*.json ./packages/common/
|
||||||
|
RUN cd packages/common && npm install
|
||||||
|
COPY packages/common/ ./packages/common/
|
||||||
|
RUN cd packages/common && npm run build
|
||||||
|
|
||||||
|
# Install service dependencies
|
||||||
|
COPY services/user-service/package*.json ./services/user-service/
|
||||||
|
WORKDIR /app/services/user-service
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
|
||||||
|
# Copy common package into node_modules for runtime resolution
|
||||||
|
RUN mkdir -p node_modules/@genex/common && \
|
||||||
|
cp -r /app/packages/common/dist node_modules/@genex/common/ && \
|
||||||
|
cp /app/packages/common/package.json node_modules/@genex/common/
|
||||||
|
|
||||||
|
# Copy service source and build
|
||||||
|
COPY services/user-service/ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apk add --no-cache dumb-init
|
RUN apk add --no-cache dumb-init
|
||||||
COPY --from=builder /app/dist ./dist
|
COPY --from=builder /app/services/user-service/dist ./dist
|
||||||
COPY --from=builder /app/node_modules ./node_modules
|
COPY --from=builder /app/services/user-service/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./
|
COPY --from=builder /app/services/user-service/package.json ./
|
||||||
USER node
|
USER node
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
# Graceful shutdown: dumb-init forwards signals properly
|
|
||||||
CMD ["dumb-init", "node", "dist/main"]
|
CMD ["dumb-init", "node", "dist/main"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue