From 788de594f2f55c2b30565e2860d0b2a7fc28de15 Mon Sep 17 00:00:00 2001 From: dela Date: Wed, 11 Feb 2026 20:01:58 +0800 Subject: [PATCH] fix:port --- Dockerfile | 4 ++-- docker-compose.yml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ed63c34..ee31379 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,7 @@ RUN npm run build # Production image, copy all the files and run next FROM base AS runner WORKDIR /app -ENV NODE_ENV production +ENV NODE_ENV=production RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs @@ -31,5 +31,5 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs EXPOSE 3000 -ENV PORT 3000 +ENV PORT=3000 CMD ["node", "server.js"] diff --git a/docker-compose.yml b/docker-compose.yml index 24ef3a6..dd7035a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,10 +8,11 @@ services: dockerfile: Dockerfile args: # REPLACE THIS with your actual backend URL (e.g., https://api.yourdomain.com) - # Since this is a client-side var, it cannot be "localhost" if accessed from outside the server. - NEXT_PUBLIC_API_URL: 0.0.0.0:8765 + # 0.0.0.0 does NOT work for browsers. Use 127.0.0.1 for local, or public IP for server. + NEXT_PUBLIC_API_URL: http://127.0.0.1:8765 restart: always ports: - - "3000:3000" + # Maps host port 3001 to container port 3000 to avoid conflict + - "3001:3000" environment: - NODE_ENV=production