FROM node:20-alpine AS builder WORKDIR /app # Copy dependency files COPY package.json package-lock.json ./ # Install dependencies RUN npm ci # Copy source code COPY . . # Build argument for API URL ARG API_URL ENV API_URL=$API_URL # Build the application RUN npm run build # Production image FROM node:20-alpine AS runner WORKDIR /app ENV NODE_ENV=production # Copy built artifacts from builder COPY --from=builder /app/public ./public COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/static ./.next/static # Expose port EXPOSE 3000 # Start command CMD ["node", "server.js"]