Skip to content

Commit

Permalink
Build Webapp Docker Image for Minikube Remote
Browse files Browse the repository at this point in the history
  • Loading branch information
AvocadoMoon committed Oct 9, 2024
1 parent f02bcaa commit f17b6ae
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docker/build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,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() {
Expand Down
24 changes: 24 additions & 0 deletions webapp-ng/Dockerfile-webapp-remote
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions webapp-ng/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}

},
Expand All @@ -161,6 +187,9 @@
},
"configuration_island": {
"buildTarget": "login-demo:build:configuration_island"
},
"configuration_remote": {
"buildTarget": "login-demo:build:configuration_remote"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions webapp-ng/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
44 changes: 44 additions & 0 deletions webapp-ng/src/environments/environment.remote.ts
Original file line number Diff line number Diff line change
@@ -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'
}
}
},
],

},
};

0 comments on commit f17b6ae

Please sign in to comment.