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:
Trey t
2026-03-04 21:23:01 -06:00
parent 8206072b71
commit ff6921b2f4
+9
View File
@@ -7,6 +7,15 @@ COPY package*.json ./
RUN npm ci RUN npm ci
COPY . . 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 RUN npm run build
# Production stage # Production stage