diff --git a/Dockerfile b/Dockerfile index 63237c5da6..9a976b1646 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,13 @@ COPY eform-client ./ RUN apt-get update RUN apt-get -y -q install ca-certificates RUN yarn install -RUN yarn build +RUN if [ "$DISABLE_SENTRY" = "true" ]; then \ + echo "Building with Sentry disabled (docker configuration)"; \ + yarn build --configuration=docker; \ + else \ + echo "Building with Sentry enabled (production configuration)"; \ + yarn build; \ + fi RUN if [ -n "$SENTRY_AUTH_TOKEN" ] && [ "$DISABLE_SENTRY" != "true" ]; then yarn sentrysourcemap; else echo "Sentry sourcemap upload skipped (DISABLE_SENTRY=$DISABLE_SENTRY)"; fi FROM mcr.microsoft.com/dotnet/sdk:10.0-noble AS build-env diff --git a/Dockerfile-big b/Dockerfile-big index 6e330376f4..ae30cf228a 100644 --- a/Dockerfile-big +++ b/Dockerfile-big @@ -1,13 +1,21 @@ FROM node:18.12.1 as node-env WORKDIR /app +ARG DISABLE_SENTRY ENV PATH /app/node_modules/.bin:$PATH COPY eform-client ./ RUN npm install -RUN npm run build +RUN if [ "$DISABLE_SENTRY" = "true" ]; then \ + echo "Building with Sentry disabled (docker configuration)"; \ + npm run build -- --configuration=docker; \ + else \ + echo "Building with Sentry enabled (production configuration)"; \ + npm run build; \ + fi FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env WORKDIR /app ARG GITVERSION +ARG DISABLE_SENTRY # Copy csproj and restore as distinct layers COPY eFormAPI/eFormAPI.Web ./ @@ -17,6 +25,8 @@ RUN pwd # Build runtime image FROM mcr.microsoft.com/dotnet/aspnet:10.0 WORKDIR /app +ARG DISABLE_SENTRY +ENV DISABLE_SENTRY=${DISABLE_SENTRY} COPY --from=build-env /app/out . COPY --from=node-env /app/dist wwwroot RUN rm connection.json; exit 0 diff --git a/eform-client/angular.json b/eform-client/angular.json index e33f9e9b38..30175101c6 100644 --- a/eform-client/angular.json +++ b/eform-client/angular.json @@ -83,6 +83,26 @@ "namedChunks": false, "aot": true, "extractLicenses": true + }, + "docker": { + "budgets": [ + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ], + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.docker.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true } }, "defaultConfiguration": "production" diff --git a/eform-client/src/environments/environment.docker.ts b/eform-client/src/environments/environment.docker.ts new file mode 100644 index 0000000000..d532abd342 --- /dev/null +++ b/eform-client/src/environments/environment.docker.ts @@ -0,0 +1,5 @@ + +export const environment = { + production: true, + enableSentry: false // Disable Sentry for Docker testing/CI +};