feat(docker): add env var substitution for nginx config at runtime
CI Pipeline / HTML Lint (push) Successful in 6s
Deploy QA / Build and Push (push) Successful in 13s
CI Pipeline / Build Docker Image (push) Failing after 1m36s
CI Pipeline / Security Scan (push) Has been skipped
Deploy QA / Deploy to QA (push) Failing after 2s
CI Pipeline / Generate Summary (push) Failing after 1s
Deploy QA / Notification (push) Failing after 1s
CI Pipeline / HTML Lint (push) Successful in 6s
Deploy QA / Build and Push (push) Successful in 13s
CI Pipeline / Build Docker Image (push) Failing after 1m36s
CI Pipeline / Security Scan (push) Has been skipped
Deploy QA / Deploy to QA (push) Failing after 2s
CI Pipeline / Generate Summary (push) Failing after 1s
Deploy QA / Notification (push) Failing after 1s
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
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ LABEL org.opencontainers.image.created="${BUILD_DATE}"
|
|||||||
LABEL org.opencontainers.image.revision="${GIT_COMMIT}"
|
LABEL org.opencontainers.image.revision="${GIT_COMMIT}"
|
||||||
LABEL org.opencontainers.image.source="https://git.kubistudio.cloud/kubistudio/cicd-multi-env-pipeline-poc"
|
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 nginx.conf /etc/nginx/nginx.conf
|
||||||
COPY src/ /usr/share/nginx/html/
|
COPY src/ /usr/share/nginx/html/
|
||||||
|
|||||||
@@ -21,4 +21,9 @@ window.__ENV__ = {
|
|||||||
};
|
};
|
||||||
EOF
|
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 "$@"
|
exec "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user