fix: pass NEXT_PUBLIC_API_URL as Docker build ARG so Next.js bakes it into bundle
This commit is contained in:
parent
e097b5f17b
commit
ef3f2ace25
1 changed files with 5 additions and 1 deletions
|
|
@ -15,6 +15,10 @@ RUN test -f .env.local || echo "# placeholder" > .env.local
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN pnpm install --frozen-lockfile --ignore-scripts
|
RUN pnpm install --frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
|
# Inject NEXT_PUBLIC_API_URL at build time (Next.js bakes NEXT_PUBLIC_* into the bundle)
|
||||||
|
ARG NEXT_PUBLIC_API_URL
|
||||||
|
ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
|
|
@ -38,4 +42,4 @@ ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ["/app/node_modules/.bin/next", "start"]
|
CMD ["/app/node_modules/.bin/next", "start"]
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue