# Use Node.js 18 LTS FROM node:20-alpine # Install MongoDB CLI tools, curl, and jq for import operations and health checks RUN apk add --no-cache mongodb-tools curl jq # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ # Install all dependencies (including TypeScript for config transpilation) RUN npm ci # Copy application code COPY . . # Create uploads directory for images RUN mkdir -p uploads # Build the application RUN npm run build # Expose port EXPOSE 3000 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:3000/api/health | jq -e '.status == "healthy"' || exit 1 # Start the application CMD ["npm", "start"]