26 lines
696 B
Docker
26 lines
696 B
Docker
# Packs a pre-built Next.js standalone output — no npm / next build on the server.
|
|
# Expects build context:
|
|
# prebuilt/standalone/ ← contents of .next/standalone
|
|
# prebuilt/static/ ← contents of .next/static
|
|
# prebuilt/public/ ← public/
|
|
|
|
FROM node:22-alpine AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV PORT=3000
|
|
ENV HOSTNAME=0.0.0.0
|
|
|
|
RUN addgroup --system --gid 1001 nodejs \
|
|
&& adduser --system --uid 1001 nextjs
|
|
|
|
COPY --chown=nextjs:nodejs prebuilt/standalone/ ./
|
|
COPY --chown=nextjs:nodejs prebuilt/public ./public
|
|
COPY --chown=nextjs:nodejs prebuilt/static ./.next/static
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "server.js"]
|