diff --git a/src/UI/NCafe.Web/Dockerfile b/src/UI/NCafe.Web/Dockerfile index 4cc486d..da375d0 100644 --- a/src/UI/NCafe.Web/Dockerfile +++ b/src/UI/NCafe.Web/Dockerfile @@ -1,7 +1,10 @@ -FROM nginx:alpine +FROM nginx:1.25-alpine WORKDIR /user/share/nginx/html EXPOSE 80 -COPY output/wwwroot . - COPY nginx.conf /etc/nginx/nginx.conf + +COPY prepare-appsettings.sh /docker-entrypoint.d/ +RUN chmod +x /docker-entrypoint.d/prepare-appsettings.sh + +COPY output/wwwroot . diff --git a/src/UI/NCafe.Web/appspec.yaml b/src/UI/NCafe.Web/appspec.yaml index c0d490a..0af20bf 100644 --- a/src/UI/NCafe.Web/appspec.yaml +++ b/src/UI/NCafe.Web/appspec.yaml @@ -2,9 +2,8 @@ name: ncafe-web-ui ingress: enabled: true - path: /web hosts: - - ncafe-dev.fredi.au + - ncafe-ui-dev.fredi.au resources: requests: @@ -15,11 +14,11 @@ resources: memory: 512Mi environment: - - name: AdminBaseAddress + - name: ADMIN_BASE_ADDRESS value: "https://ncafe-dev.fredi.au/admin" - - name: CashierBaseAddress + - name: CASHIER_BASE_ADDRESS value: "https://ncafe-dev.fredi.au/cashier" - - name: BaristaBaseAddress + - name: BARISTA_BASE_ADDRESS value: "https://ncafe-dev.fredi.au/barista" replicaCount: 1 diff --git a/src/UI/NCafe.Web/prepare-appsettings.sh b/src/UI/NCafe.Web/prepare-appsettings.sh new file mode 100644 index 0000000..2d3aa5e --- /dev/null +++ b/src/UI/NCafe.Web/prepare-appsettings.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +APPSETTINGS=/user/share/nginx/html/appsettings.json + +# delete compressed (brotli/gzip) appsettings files +rm "$APPSETTINGS.br" +rm "$APPSETTINGS.gz" + +# update base address value using environment variables +sed -i -E "s|(\"AdminBaseAddress\"\:) \"(.*)\"(,)?|\1 \"$ADMIN_BASE_ADDRESS\"\3|g" $APPSETTINGS +sed -i -E "s|(\"CashierBaseAddress\"\:) \"(.*)\"(,)?|\1 \"$CASHIER_BASE_ADDRESS\"\3|g" $APPSETTINGS +sed -i -E "s|(\"BaristaBaseAddress\"\:) \"(.*)\"(,)?|\1 \"$BARISTA_BASE_ADDRESS\"\3|g" $APPSETTINGS + +cat $APPSETTINGS