diff --git a/web/Dockerfile b/web/Dockerfile index e0fa59dcfec6..1a6d017d96c5 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -18,6 +18,9 @@ FROM base AS builder RUN apk add --no-cache libc6-compat WORKDIR /app +# Add NODE_OPTIONS argument +ARG NODE_OPTIONS + # pull in source code / package.json / package-lock.json COPY . . @@ -78,7 +81,8 @@ ENV NEXT_PUBLIC_GTM_ENABLED=${NEXT_PUBLIC_GTM_ENABLED} ARG NEXT_PUBLIC_FORGOT_PASSWORD_ENABLED ENV NEXT_PUBLIC_FORGOT_PASSWORD_ENABLED=${NEXT_PUBLIC_FORGOT_PASSWORD_ENABLED} -RUN npx next build +# Use NODE_OPTIONS in the build command +RUN NODE_OPTIONS="${NODE_OPTIONS}" npx next build # Step 2. Production image, copy all the files and run next FROM base AS runner diff --git a/web/next.config.js b/web/next.config.js index 7db0f86534ff..f8ca77b622ef 100644 --- a/web/next.config.js +++ b/web/next.config.js @@ -86,14 +86,16 @@ const sentryWebpackPluginOptions = { authToken: process.env.SENTRY_AUTH_TOKEN, silent: !sentryEnabled, // Silence output when Sentry is disabled dryRun: !sentryEnabled, // Don't upload source maps when Sentry is disabled - sourceMaps: { - include: ["./.next"], - ignore: ["node_modules"], - urlPrefix: "~/_next", - stripPrefix: ["webpack://_N_E/"], - validate: true, - cleanArtifacts: true, - }, + ...(sentryEnabled && { + sourceMaps: { + include: ["./.next"], + ignore: ["node_modules"], + urlPrefix: "~/_next", + stripPrefix: ["webpack://_N_E/"], + validate: true, + cleanArtifacts: true, + }, + }), }; // Export the module with conditional Sentry configuration