FROM node:22-bookworm-slim AS runner WORKDIR /app ENV NODE_ENV production ENV NEXT_PRIVATE_STANDALONE true RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs # Copy standalone output # The context is now the standalone folder itself COPY --chown=nextjs:nodejs . . USER nextjs EXPOSE 3000 ENV PORT 3000 ENV HOSTNAME "0.0.0.0" HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ CMD node -e "fetch('http://localhost:' + (process.env.PORT || 3000) + '/api/health').then(r => process.exit(r.ok ? 0 : 1)).catch(() => process.exit(1))" CMD ["node", "server.js"]