# Document Translation Frontend - Dockerfile # Multi-stage build for optimized production # Build stage FROM node:20-alpine AS builder WORKDIR /app # Copy package files COPY frontend/package*.json ./ # Install dependencies RUN npm ci --only=production=false # Copy source code COPY frontend/ . # Build arguments for environment ARG NEXT_PUBLIC_API_URL=http://localhost:8000 ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} # Build the application RUN npm run build # Production stage FROM node:20-alpine AS production WORKDIR /app # Create non-root user RUN addgroup -g 1001 -S nodejs && \ adduser -S nextjs -u 1001 # Copy built assets from builder COPY --from=builder /app/public ./public COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/static ./.next/static # Set correct permissions RUN chown -R nextjs:nodejs /app USER nextjs # Environment ENV NODE_ENV=production \ PORT=3000 \ HOSTNAME="0.0.0.0" EXPOSE 3000 CMD ["node", "server.js"]