diff --git a/Dockerfile b/Dockerfile index 9f961b9bb..7c8fa150e 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 -- --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..116205a34 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 { + let 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;