36 lines
930 B
Docker
36 lines
930 B
Docker
# =============================================================================
|
|
# Telemetry Service Dockerfile
|
|
# =============================================================================
|
|
|
|
FROM node:20-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
COPY tsconfig.json ./
|
|
COPY nest-cli.json ./
|
|
|
|
RUN npm ci
|
|
|
|
COPY src ./src
|
|
|
|
RUN npm run build
|
|
|
|
# ─── Production stage ────────────────────────────────────────────────────────
|
|
FROM node:20-alpine
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache dumb-init curl
|
|
|
|
COPY --from=builder /app/package*.json ./
|
|
RUN npm ci --only=production
|
|
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
USER node
|
|
EXPOSE 3011
|
|
|
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
CMD curl -f http://localhost:3011/api/v1/health || exit 1
|
|
|
|
CMD ["dumb-init", "node", "dist/main"]
|