refactor: update Dockerfile and docker-compose.yml for Next.js 15 optimization and standalone output
This commit is contained in:
+5
-6
@@ -65,12 +65,11 @@ ENV HOSTNAME="0.0.0.0"
|
||||
RUN addgroup --system --gid 1001 nodejs && \
|
||||
adduser --system --uid 1001 nextjs
|
||||
|
||||
# Copy necessary files from builder
|
||||
# Copy necessary files from builder (standalone mode)
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/next.config.js ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/package.json ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/node_modules ./node_modules
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
|
||||
# Switch to non-root user
|
||||
USER nextjs
|
||||
@@ -85,5 +84,5 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
# Use dumb-init to handle signals properly
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
|
||||
# Start Next.js in production mode
|
||||
CMD ["node_modules/.bin/next", "start"]
|
||||
# Start Next.js in standalone mode
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user