From e657d9a629c921e4c8034db6c32f1da3201b2739 Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 9 Feb 2024 11:56:09 +0100 Subject: [PATCH 1/5] Update Dockerfile and app-config.service.ts to work with helm --- Dockerfile | 4 +++- src/modules/app/app-config.service.ts | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9f961b9bb..61b08563e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ # Stage 1: Compile and Build angular codebase FROM node:lts as build +ARG BASE_PATH + WORKDIR /app COPY ./ /app/ RUN npm install -RUN npm run build +RUN npm run build -- --prod --base-href=$BASE_PATH # Stage 2: Serve app with nginx FROM nginx:alpine diff --git a/src/modules/app/app-config.service.ts b/src/modules/app/app-config.service.ts index b0782862a..635ba603e 100644 --- a/src/modules/app/app-config.service.ts +++ b/src/modules/app/app-config.service.ts @@ -1,5 +1,6 @@ import {HttpClient} from '@angular/common/http'; import {Injectable} from '@angular/core'; +import { LocationStrategy } from '@angular/common'; export interface AppConfig { managementApiUrl: string; @@ -15,11 +16,13 @@ export interface AppConfig { export class AppConfigService { config?: AppConfig; - constructor(private http: HttpClient) {} + constructor(private http: HttpClient, private locationStrategy: LocationStrategy) {} loadConfig(): Promise { + const appConfigUrl = this.locationStrategy.prepareExternalUrl('assets/config/app.config.json'); + return this.http - .get('/assets/config/app.config.json') + .get(appConfigUrl) .toPromise() .then(data => { this.config = data; From 803eb9bcae550bf6c63bb362c52a8ddf4569ff45 Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 9 Feb 2024 12:09:14 +0100 Subject: [PATCH 2/5] Update Dockerfile and app-config.service.ts to work with helm --- src/modules/app/app-config.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/app/app-config.service.ts b/src/modules/app/app-config.service.ts index 635ba603e..116205a34 100644 --- a/src/modules/app/app-config.service.ts +++ b/src/modules/app/app-config.service.ts @@ -19,7 +19,7 @@ export class AppConfigService { constructor(private http: HttpClient, private locationStrategy: LocationStrategy) {} loadConfig(): Promise { - const appConfigUrl = this.locationStrategy.prepareExternalUrl('assets/config/app.config.json'); + let appConfigUrl = this.locationStrategy.prepareExternalUrl('assets/config/app.config.json'); return this.http .get(appConfigUrl) From 16ae00d678b970e006c5312f4abb14299de9504c Mon Sep 17 00:00:00 2001 From: farhin23 Date: Tue, 5 Mar 2024 16:05:39 +0100 Subject: [PATCH 3/5] Update build command in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 61b08563e..d4594cf4a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ARG BASE_PATH WORKDIR /app COPY ./ /app/ RUN npm install -RUN npm run build -- --prod --base-href=$BASE_PATH +RUN npm run build --base-href=$BASE_PATH # Stage 2: Serve app with nginx FROM nginx:alpine From 921f6e3564554f416f65f46a8b5152f04422db7c Mon Sep 17 00:00:00 2001 From: farhin23 Date: Tue, 5 Mar 2024 21:26:56 +0100 Subject: [PATCH 4/5] Update build command in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d4594cf4a..dc9f74d7c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,7 @@ ARG BASE_PATH WORKDIR /app COPY ./ /app/ RUN npm install -RUN npm run build --base-href=$BASE_PATH +RUN npm run build -- --base-href=$BASE_PATH # Stage 2: Serve app with nginx FROM nginx:alpine From b3f6cc899aa9677ac15b38e39e828c441af76b56 Mon Sep 17 00:00:00 2001 From: farhin23 Date: Fri, 3 May 2024 14:07:26 +0200 Subject: [PATCH 5/5] Update Dockerfile - add default base path --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index dc9f74d7c..7c8fa150e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Stage 1: Compile and Build angular codebase FROM node:lts as build -ARG BASE_PATH +ARG BASE_PATH=/ WORKDIR /app COPY ./ /app/