Add Docker build args for NEXT_PUBLIC env vars
Next.js NEXT_PUBLIC_* variables are baked in at build time, not runtime. Without ARG declarations in the Dockerfile, Dokku's --build-arg flags have no effect and PostHog/API URLs are undefined in the client bundle. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,15 @@ COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY . .
|
||||
|
||||
# Next.js NEXT_PUBLIC_* vars must be present at build time
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
ARG NEXT_PUBLIC_POSTHOG_KEY
|
||||
ARG NEXT_PUBLIC_POSTHOG_HOST
|
||||
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||
ENV NEXT_PUBLIC_POSTHOG_KEY=$NEXT_PUBLIC_POSTHOG_KEY
|
||||
ENV NEXT_PUBLIC_POSTHOG_HOST=$NEXT_PUBLIC_POSTHOG_HOST
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# Production stage
|
||||
|
||||
Reference in New Issue
Block a user