morethanadiagnosis-hub/web/Dockerfile
admin 6423df91e3 deploy: add frontend service with production Docker setup
- Created production Dockerfile for Next.js frontend (multi-stage build)
- Added frontend service to docker-compose with API env var
- Updated nginx to proxy root path to frontend:3000 service
- Frontend fully integrated with backend at https://mtd.runfoo.run

Job ID: MTAD-IMPL-2025-11-18-CL
2025-11-18 07:00:00 +00:00

44 lines
674 B
Docker

# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source
COPY . .
# Build the app
RUN npm run build
# Production stage
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install production dependencies only
RUN npm ci --omit=dev
# Copy built app from builder
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
# Create non-root user
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
# Set permissions
RUN chown -R nextjs:nodejs /app
USER nextjs
# Start the app
CMD ["npm", "run", "start"]
EXPOSE 3000