build(sentry): accept Sentry build args in Dockerfile
NEXT_PUBLIC_SENTRY_DSN must be present at build time so Next.js inlines it into the client bundle. SENTRY_AUTH_TOKEN must be present at build time so withSentryConfig can upload source maps to Sentry. Coolify already passes both as --build-arg; this declares the matching ARG lines so the builder stage actually consumes them. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -20,6 +20,18 @@ ENV NODE_ENV=production
|
||||
# Force Prisma to generate linux-musl-openssl-3.0.x binary (Alpine 3.21 uses OpenSSL 3.x)
|
||||
ENV PRISMA_CLI_BINARY_TARGETS=linux-musl-openssl-3.0.x
|
||||
|
||||
# Sentry: NEXT_PUBLIC_SENTRY_DSN gets inlined into the client bundle
|
||||
# during `npm run build` (any NEXT_PUBLIC_* var must be present at
|
||||
# build time, not just runtime). SENTRY_AUTH_TOKEN is consumed by
|
||||
# withSentryConfig to upload source maps to Sentry as part of the
|
||||
# build. Coolify already marks both as is_buildtime:true and passes
|
||||
# them via --build-arg; these ARG lines accept them and re-export
|
||||
# as ENV so `next build` and the Sentry wrapper see them.
|
||||
ARG NEXT_PUBLIC_SENTRY_DSN
|
||||
ARG SENTRY_AUTH_TOKEN
|
||||
ENV NEXT_PUBLIC_SENTRY_DSN=$NEXT_PUBLIC_SENTRY_DSN
|
||||
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
|
||||
|
||||
RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
|
||||
Reference in New Issue
Block a user