diff --git a/Dockerfile b/Dockerfile index 5c10f55..19f752e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,12 @@ RUN corepack enable && \ pnpm config set store-dir /opt/michess/.pnpm-store && \ pnpm install --no-frozen-lockfile +# Build-time env vars for Next.js (baked into the frontend bundle) +ARG NEXT_PUBLIC_API_URL=http://localhost:3001 +ARG NEXT_PUBLIC_APP_URL=http://localhost:3000 +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_APP_URL=$NEXT_PUBLIC_APP_URL + # Build server and client RUN pnpm build:server && pnpm build:client diff --git a/docker-compose.yml b/docker-compose.yml index 5274476..423f39c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,10 @@ services: michess: - build: . + build: + context: . + args: + NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-http://localhost:3001} + NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:3000} image: michess:latest container_name: michess restart: unless-stopped