# Backend Dockerfile FROM node:18-alpine AS base # Create app directory WORKDIR /app # Install app dependencies COPY backend/package*.json ./ RUN npm ci --only=production && npm cache clean --force # Copy backend source code COPY backend/ . # Create non-root user RUN addgroup -g 1001 -S nodejs && \ adduser -S nodejs -u 1001 # Set ownership and permissions RUN chown -R nodejs:nodejs /app USER nodejs # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD node healthcheck.js || exit 1 # Expose port EXPOSE 5000 # Start the application CMD ["node", "server.js"]