33 lines
1.0 KiB
Docker
33 lines
1.0 KiB
Docker
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# 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
|
|
|
|
# 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
|
|
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
RUN apk add --no-cache dumb-init
|
|
COPY --from=builder /app/services/issuer-service/dist ./dist
|
|
COPY --from=builder /app/services/issuer-service/node_modules ./node_modules
|
|
COPY --from=builder /app/services/issuer-service/package.json ./
|
|
USER node
|
|
EXPOSE 3002
|
|
CMD ["dumb-init", "node", "dist/main"]
|