From c54bf575a8b75f4c1145c8284ad4a10909091b6d Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sun, 6 Feb 2022 10:52:23 +0200 Subject: Dockerize for prod --- prod_bootstrap.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 prod_bootstrap.sh (limited to 'prod_bootstrap.sh') diff --git a/prod_bootstrap.sh b/prod_bootstrap.sh new file mode 100755 index 0000000..c1de926 --- /dev/null +++ b/prod_bootstrap.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euo pipefail +DIR="${1}" +VALID_ENV_KEYS=$(printenv | awk -F '=' '{ print $1 }' | tail | awk 'NF') + +for f in $(find ${DIR} -regex '.*\.js'); do + for envKey in ${VALID_ENV_KEYS}; do + replaced=$(printenv ${envKey}) + sed -i "s|%${envKey}|${replaced}|g" "${f}" + echo "[bootstrap] Replaced ${envKey} from container environment." + done +done + +nginx -g "daemon off;" -- cgit v1.3