# --- STAGE 1: BUILDER --- FROM node:20-alpine AS builder WORKDIR /app # Install dependencies COPY package*.json ./ RUN npm install # Copy source code COPY . . # Build Next.js app # NEXT_PUBLIC_API_URL should be set during build if used in static generation # For production, we usually point to the domain name ENV NEXT_PUBLIC_API_URL=https://api.iddaai.com/api RUN npm run build # --- STAGE 2: RUNNER --- FROM node:20-alpine AS runner WORKDIR /app ENV NODE_ENV=production # Copy only necessary files COPY --from=builder /app/package*.json ./ COPY --from=builder /app/.next ./.next COPY --from=builder /app/public ./public COPY --from=builder /app/node_modules ./node_modules COPY --from=builder /app/next.config.ts ./ # Copy messages for internationalization COPY --from=builder /app/messages ./messages EXPOSE 3000 # Start Next.js CMD ["npm", "start"]