From a571438459ad17cef58820e51859c4cbfd2f2be2 Mon Sep 17 00:00:00 2001 From: hienp Date: Thu, 2 Apr 2026 10:33:05 +0700 Subject: [PATCH] =?UTF-8?q?update=20port=20ph=C3=B9=20h=E1=BB=A3p=20l?= =?UTF-8?q?=C3=A0=208001=20v=C3=A0=203011?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 2 +- backend/entrypoint.sh | 2 +- build.sh | 2 +- deploy.sh | 2 +- docker-compose.yml | 8 ++++---- frontend/Dockerfile | 6 ++++-- frontend/next.config.js | 4 ++-- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.env.example b/.env.example index db46c22..2ba9c36 100644 --- a/.env.example +++ b/.env.example @@ -16,7 +16,7 @@ ACCESS_TOKEN_EXPIRE_MINUTES=60 # ── Ports ───────────────────────────────────────────────────────────────────── # Port exposed on the host for the Next.js frontend -FRONTEND_PORT=3000 +FRONTEND_PORT=3011 # ── Docker Hub images (optional — leave blank to build locally) ─────────────── # Set these on the target machine so docker compose pull works without building diff --git a/backend/entrypoint.sh b/backend/entrypoint.sh index 2fc5c65..7d38e71 100644 --- a/backend/entrypoint.sh +++ b/backend/entrypoint.sh @@ -6,4 +6,4 @@ echo "⏳ Running Alembic migrations..." alembic upgrade head echo "🚀 Starting FastAPI..." -exec uvicorn main:app --host 0.0.0.0 --port 8000 +exec uvicorn main:app --host 0.0.0.0 --port 8001 diff --git a/build.sh b/build.sh index 2e9c69d..83830af 100755 --- a/build.sh +++ b/build.sh @@ -163,7 +163,7 @@ done # ───────────────────────────────────────────────────────────────────────────── # Summary # ───────────────────────────────────────────────────────────────────────────── -PORT="${FRONTEND_PORT:-3000}" +PORT="${FRONTEND_PORT:-3011}" echo "" echo -e "${BOLD}${GREEN}══════════════════════════════════════════${RESET}" echo -e "${BOLD}${GREEN} ✅ LMS is up!${RESET}" diff --git a/deploy.sh b/deploy.sh index 45eab80..f9ec47f 100755 --- a/deploy.sh +++ b/deploy.sh @@ -38,5 +38,5 @@ echo "🚀 Starting stack..." docker compose up -d echo "" -echo "✅ Running! Open http://localhost:${FRONTEND_PORT:-3000}" +echo "✅ Running! Open http://localhost:${FRONTEND_PORT:-3011}" docker compose ps diff --git a/docker-compose.yml b/docker-compose.yml index ad0c9f7..7375241 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -53,7 +53,7 @@ services: volumes: - pdf_uploads:/uploads expose: - - "8000" + - "8001" networks: - lms_net @@ -64,15 +64,15 @@ services: context: ./frontend dockerfile: Dockerfile args: - NEXT_PUBLIC_API_URL: http://backend:8000 + NEXT_PUBLIC_API_URL: http://backend:8001 restart: unless-stopped depends_on: - backend environment: - NEXT_PUBLIC_API_URL: http://backend:8000 + NEXT_PUBLIC_API_URL: http://backend:8001 NODE_ENV: production ports: - - "${FRONTEND_PORT:-3000}:3000" + - "${FRONTEND_PORT:-3011}:3011" networks: - lms_net diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 5531de7..348f427 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -13,7 +13,7 @@ COPY --from=deps /app/node_modules ./node_modules COPY . . # NEXT_PUBLIC_API_URL is baked in at build time via docker-compose build args -ARG NEXT_PUBLIC_API_URL=http://backend:8000 +ARG NEXT_PUBLIC_API_URL=http://backend:8001 ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL RUN mkdir -p /app/public && npm run build @@ -32,6 +32,8 @@ COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/next.config.js ./ -EXPOSE 3000 +EXPOSE 3011 + +ENV PORT=3011 CMD ["node", "server.js"] diff --git a/frontend/next.config.js b/frontend/next.config.js index 7bb50db..c26d211 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -5,11 +5,11 @@ const nextConfig = { return [ { source: "/api/:path*", - destination: `${process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000"}/api/:path*`, + destination: `${process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8001"}/api/:path*`, }, { source: "/ws/:path*", - destination: `${process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000"}/ws/:path*`, + destination: `${process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8001"}/ws/:path*`, }, ]; },