From c52dcda03b525704187093612248dcf92c52af96 Mon Sep 17 00:00:00 2001 From: Nicholas Ceballos Date: Mon, 1 Jun 2026 17:11:18 -0600 Subject: [PATCH] feat(docker): add env var substitution for nginx config at runtime install gettext package via apk to get envsubst tool update docker-entrypoint.sh to export APP_ENV and APP_VERSION, then substitute these variables into the nginx configuration file before executing the main command --- Dockerfile | 2 +- docker-entrypoint.sh | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4bd1ee4..89e3145 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,7 +17,7 @@ LABEL org.opencontainers.image.created="${BUILD_DATE}" LABEL org.opencontainers.image.revision="${GIT_COMMIT}" LABEL org.opencontainers.image.source="https://git.kubistudio.cloud/kubistudio/cicd-multi-env-pipeline-poc" -RUN apk add --no-cache curl +RUN apk add --no-cache curl gettext COPY nginx.conf /etc/nginx/nginx.conf COPY src/ /usr/share/nginx/html/ diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 7c8f8d5..f2dd1ef 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -21,4 +21,9 @@ window.__ENV__ = { }; EOF +export APP_ENV APP_VERSION + +envsubst '${APP_ENV} ${APP_VERSION}' < /etc/nginx/nginx.conf > /etc/nginx/nginx.conf.tmp +mv /etc/nginx/nginx.conf.tmp /etc/nginx/nginx.conf + exec "$@"