summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/docker-inject-env24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/docker-inject-env b/bin/docker-inject-env
new file mode 100755
index 0000000..e404cec
--- /dev/null
+++ b/bin/docker-inject-env
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# input:
+# SOURCE_IMAGE: Image name for the source image
+# TARGET_IMAGE: Name of image to build
+# DOTENV: The list of env variables delimited by a ;
+# e.g. DOTENV="FEATURE_RUBY_REPORT 'false';LM_REPORT_VERSION 1;"
+
+set -e
+
+cd "$(dirname "$0")/.."
+DOCKERFILE=Dockerfile.env
+
+rm -f $DOCKERFILE
+touch $DOCKERFILE
+echo "FROM $SOURCE_IMAGE" > $DOCKERFILE
+
+IFS=';' read -ra EACH_ENV <<< "$DOTENV"
+for i in "${EACH_ENV[@]}"; do
+ echo "ENV $i" >> $DOCKERFILE
+done
+
+docker pull $SOURCE_IMAGE
+docker build -t $TARGET_IMAGE -f $DOCKERFILE .