# Multi-stage build for ARM compatibility (Raspberry Pi) FROM node:18-alpine AS builder WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production # Copy source code COPY . . # --- Production stage --- FROM node:18-alpine # Install curl for health checks RUN apk add --no-cache curl WORKDIR /app # Copy dependencies from builder COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app . # Create uploads directory RUN mkdir -p uploads # Expose port EXPOSE 5000 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=40s \ CMD node -e "require('http').get('http://localhost:5000/api/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})" # Start server CMD ["node", "server.js"]