c52dcda03b
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
30 lines
724 B
Bash
30 lines
724 B
Bash
#!/bin/sh
|
|
set -euo pipefail
|
|
|
|
APP_ENV="${APP_ENV:-development}"
|
|
APP_VERSION="${APP_VERSION:-0.0.0}"
|
|
BUILD_DATE="${BUILD_DATE:-}"
|
|
GIT_COMMIT="${GIT_COMMIT:-}"
|
|
GIT_BRANCH="${GIT_BRANCH:-}"
|
|
DEPLOY_TIME="${DEPLOY_TIME:-}"
|
|
BUILD_NUMBER="${BUILD_NUMBER:-}"
|
|
|
|
cat > /usr/share/nginx/html/env-config.js << EOF
|
|
window.__ENV__ = {
|
|
APP_ENV: "${APP_ENV}",
|
|
APP_VERSION: "${APP_VERSION}",
|
|
BUILD_DATE: "${BUILD_DATE}",
|
|
GIT_COMMIT: "${GIT_COMMIT}",
|
|
GIT_BRANCH: "${GIT_BRANCH}",
|
|
DEPLOY_TIME: "${DEPLOY_TIME}",
|
|
BUILD_NUMBER: "${BUILD_NUMBER}"
|
|
};
|
|
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 "$@"
|