Skip to content

Instantly share code, notes, and snippets.

@mahmoudimus
Created December 18, 2014 00:20
Show Gist options
  • Save mahmoudimus/ab25f5339f2428b0a399 to your computer and use it in GitHub Desktop.
Save mahmoudimus/ab25f5339f2428b0a399 to your computer and use it in GitHub Desktop.
Patch to run on elastic beanstalk to allow docker to use an --env-file cmdline argument
--- elasticbeanstalk/hooks/appdeploy/pre/04run.sh 2014-12-12 11:07:47.000000000 -0800
+++ elasticbeanstalk/hooks/appdeploy/pre/04run.sh-new 2014-12-17 15:31:45.000000000 -0800
@@ -65,6 +65,14 @@
EB_CONFIG_DOCKER_ENV_ARGS+=(--env "$ENV_VAR")
done < <($EB_SUPPORT_FILES/generate_env)
+# build --env-file arguments for docker
+
+EB_CONFIG_DOCKER_ENVFILE=()
+
+if [ -f /root/secrets.env ]; then
+ EB_CONFIG_DOCKER_ENVFILE+=(--env-file "/root/secrets.env")
+fi
+
# port mapping
echo $EB_CONFIG_DOCKER_PORT > $EB_CONFIG_DOCKER_PORT_FILE
@@ -82,6 +90,7 @@
# run the container
docker run -d \
+ "${EB_CONFIG_DOCKER_ENVFILE[@]}" \
"${EB_CONFIG_DOCKER_ENV_ARGS[@]}" \
"${EB_CONFIG_DOCKER_VOLUME_MOUNTS[@]}" \
"${EB_CONFIG_DOCKER_ENTRYPOINT_ARGS[@]}" \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment