diff --git a/Dockerfile b/Dockerfile index 8cd24e9..c87081a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,12 @@ COPY package.json pnpm-lock.yaml ./ RUN pnpm install --frozen-lockfile FROM base AS builder +# next.config.mjs evaluates rewrites() at build time, so the optional +# BACKEND_API_BASE_URL override must be available here to be baked into the +# routes manifest. Left unset, the host-based routing (opplens.com vs +# opplenz.com) applies and no env is needed. +ARG BACKEND_API_BASE_URL +ENV BACKEND_API_BASE_URL=${BACKEND_API_BASE_URL} COPY --from=deps /app/node_modules ./node_modules COPY . . RUN pnpm run build diff --git a/next.config.mjs b/next.config.mjs index 2fcd5d7..cdcfb68 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -40,6 +40,7 @@ const nextConfig = { // Routing is host-based so neither deploy needs a custom env. A // `BACKEND_API_BASE_URL` env var (if set) overrides both — handy for local // dev pointing at e.g. http://localhost:8080/admin/v1. + //! ⚠️ IMPORTANT: Adding BACKEND_API_BASE_URL to env file will break the multi-domain feature. const override = process.env.BACKEND_API_BASE_URL; if (override) { return [