From 90f807b31d82c93a486dd6b7c15cf38fa16de48a Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 26 Jan 2026 13:08:04 +0700 Subject: [PATCH] Fix Docker build - Add PORT environment variable - Add PORT=3000 to both Dockerfile and docker-compose.yml - Ensure proper file ownership in standalone build - Fix potential 404 routing issues Co-Authored-By: Claude --- Dockerfile | 9 ++++----- docker-compose.yml | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3bd5c88..05e89b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,8 @@ WORKDIR /app # Set environment to production ENV NODE_ENV=production +ENV PORT=3000 +ENV HOSTNAME="0.0.0.0" # Create a non-root user RUN addgroup --system --gid 1001 nodejs @@ -31,8 +33,8 @@ RUN adduser --system --uid 1001 nextjs # Copy necessary files from builder COPY --from=builder /app/public ./public -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static # Change ownership to nextjs user RUN chown -R nextjs:nodejs /app @@ -43,8 +45,5 @@ USER nextjs # Expose port 3000 EXPOSE 3000 -# Set hostname -ENV HOSTNAME="0.0.0.0" - # Start the application CMD ["node", "server.js"] diff --git a/docker-compose.yml b/docker-compose.yml index a5be7f6..724c72f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,6 +9,7 @@ services: - "6969:3000" environment: - NODE_ENV=production + - PORT=3000 networks: - dokploy-network labels: