platform-codebase/features/analytics/backend-api/Dockerfile
Lilith 8c679e3f09 ♻️ Require local NLLB model, remove auto-download
- Require model to exist locally (use @ml-model-loader to download)
- Add local_files_only=True to prevent network access
- Simplify health endpoint, remove HF cache info
- Error if model not found with clear download instructions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 17:37:39 -08:00

56 lines
1.4 KiB
Docker

# Analytics Service Dockerfile
# Multi-stage build for NestJS application
# =============================================================================
# BUILD STAGE
# =============================================================================
FROM node:22-alpine AS builder
WORKDIR /app
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
# Copy package files
COPY package.json pnpm-lock.yaml* ./
# Install dependencies
RUN pnpm install --frozen-lockfile
# Copy source
COPY . .
# Build
RUN pnpm build
# Prune dev dependencies
RUN pnpm prune --prod
# =============================================================================
# PRODUCTION STAGE
# =============================================================================
FROM node:22-alpine AS production
WORKDIR /app
# Create non-root user
RUN addgroup -g 1001 -S nodejs && \
adduser -S nestjs -u 1001
# Copy built application
COPY --from=builder --chown=nestjs:nodejs /app/dist ./dist
COPY --from=builder --chown=nestjs:nodejs /app/node_modules ./node_modules
COPY --from=builder --chown=nestjs:nodejs /app/package.json ./
# Set user
USER nestjs
# Expose port
EXPOSE 3000
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
# Start application
CMD ["node", "dist/main.js"]