diff --git a/Dockerfile b/Dockerfile index 504781d..fda9e6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,3 +18,11 @@ LABEL org.opencontainers.image.source=https://git.wtf-eg.de/kompetenzinventar/ki LABEL org.opencontainers.image.url=https://git.wtf-eg.de/kompetenzinventar/ki-frontend LABEL org.opencontainers.image.documentation=https://git.wtf-eg.de/kompetenzinventar/ki-frontend#docker LABEL org.opencontainers.image.vendor="WTF Kooperative eG" + +ENV KI_API_URL http://ki-backend:5000 + +WORKDIR /usr/share/nginx/html + +COPY etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf +COPY configure.sh /docker-entrypoint.d/ +COPY --from=builder /dist . diff --git a/configure.sh b/configure.sh new file mode 100755 index 0000000..12354b5 --- /dev/null +++ b/configure.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# SPDX-FileCopyrightText: WTF Kooperative eG +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +set -o errexit +set +x + +: ${KI_API_URL:=http://ki-backend:5000} + +sed -e "s%\$KI_API_URL%$KI_API_URL%g" /usr/share/nginx/html/config.js.in > /usr/share/nginx/html/config.js + +exec "$@" diff --git a/public/config.js.in b/public/config.js.in new file mode 100644 index 0000000..fbaf4e2 --- /dev/null +++ b/public/config.js.in @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: WTF Kooperative eG +// +// SPDX-License-Identifier: AGPL-3.0-or-later + +window.ki = { + apiUrl: "$KI_API_URL" +}