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: