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 <noreply@anthropic.com>
This commit is contained in:
Max
2026-01-26 13:08:04 +07:00
parent d9c090db45
commit 90f807b31d
2 changed files with 5 additions and 5 deletions

View File

@@ -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"]

View File

@@ -9,6 +9,7 @@ services:
- "6969:3000"
environment:
- NODE_ENV=production
- PORT=3000
networks:
- dokploy-network
labels: