diff --git a/docker/build/build.sh b/docker/build/build.sh index a5c5b39872..5b1f49df33 100755 --- a/docker/build/build.sh +++ b/docker/build/build.sh @@ -136,6 +136,8 @@ build_webapp() { if [[ $? -ne 0 ]]; then echo "failed to build prod"; exit 1; fi build_webapp_common island if [[ $? -ne 0 ]]; then echo "failed to build island"; exit 1; fi + build_webapp_common remote + if [[ $? -ne 0 ]]; then echo "failed to build remote"; exit 1; fi } build_batch() { diff --git a/webapp-ng/Dockerfile-webapp-remote b/webapp-ng/Dockerfile-webapp-remote new file mode 100644 index 0000000000..ded448c15f --- /dev/null +++ b/webapp-ng/Dockerfile-webapp-remote @@ -0,0 +1,24 @@ +# Build stage +FROM node:20.11-alpine3.19 AS build + +RUN apk update && apk add git + +RUN mkdir -p /app + +WORKDIR /app + +COPY package.json . +COPY package-lock.json . + +RUN npm install --legacy-peer-deps + +COPY . . + +RUN npm run build_remote + +# ----------------- + +FROM nginx:1.17.1-alpine +COPY --from=build /app/dist/login-demo /usr/share/nginx/html +COPY ./nginx-custom.conf /etc/nginx/conf.d/default.conf +EXPOSE 80 diff --git a/webapp-ng/angular.json b/webapp-ng/angular.json index 3392559567..024c5f9592 100644 --- a/webapp-ng/angular.json +++ b/webapp-ng/angular.json @@ -139,6 +139,32 @@ "maximumWarning": "6kb" } ] + }, + "configuration_remote": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.remote.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb" + } + ] } }, @@ -161,6 +187,9 @@ }, "configuration_island": { "buildTarget": "login-demo:build:configuration_island" + }, + "configuration_remote": { + "buildTarget": "login-demo:build:configuration_remote" } } }, diff --git a/webapp-ng/package.json b/webapp-ng/package.json index debb8a544e..46cc4e5224 100644 --- a/webapp-ng/package.json +++ b/webapp-ng/package.json @@ -9,6 +9,7 @@ "build_dev": "ng build -c configuration_dev", "build_stage": "ng build -c configuration_stage", "build_island": "ng build -c configuration_island", + "build_remote": "ng build -c configuration_remote", "test": "ng test", "test:ci": "ng test --no-watch --no-progress --browsers=ChromeHeadlessCI", "lint": "ng lint", diff --git a/webapp-ng/src/environments/environment.remote.ts b/webapp-ng/src/environments/environment.remote.ts new file mode 100644 index 0000000000..30153365c1 --- /dev/null +++ b/webapp-ng/src/environments/environment.remote.ts @@ -0,0 +1,44 @@ +import config from '../../auth_config.json'; + +const { domain, clientId, authorizationParams: { audience }, apiUri, errorPath } = config as { + domain: string; + clientId: string; + authorizationParams: { + audience?: string; + }, + apiUri: string; + errorPath: string; +}; + +export const environment = { + production: true, + auth: { + domain, + clientId, + authorizationParams: { + audience: `${audience}`, + redirect_uri: window.location.origin, + }, + errorPath, + }, + apiUri: `${apiUri}`, + httpInterceptor: { + allowedList: [ + { + // uri: `${config.apiUri}/api/*`, + // uri: `${apiUri}/api/*`, + // uri: '/api/*', + uri: 'https://minikube-remote/api/*', + + // allowAnonymous: true, + tokenOptions: { + authorizationParams: { + audience: `${audience}`, + scope: 'openid profile email' + } + } + }, + ], + + }, +};