FROM node:20-alpine AS runner WORKDIR /app ENV NODE_ENV=production ENV PORT=3000 ENV HOSTNAME="0.0.0.0" RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs # Set the correct permission for prerender cache RUN mkdir .next RUN chown nextjs:nodejs .next # Copy the standalone build files from the host COPY --chown=nextjs:nodejs public ./public COPY --chown=nextjs:nodejs .next/standalone ./ COPY --chown=nextjs:nodejs .next/static ./.next/static USER nextjs EXPOSE 3000 CMD ["node", "server.js"]