Skip to content

Instantly share code, notes, and snippets.

@that0n3guy
Created February 27, 2015 18:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save that0n3guy/e392d763df4b21c04fd3 to your computer and use it in GitHub Desktop.
Save that0n3guy/e392d763df4b21c04fd3 to your computer and use it in GitHub Desktop.
dokku build with variables
#!/bin/bash
DOCKERFILE="/home/ubuntu/dockerfiletest/Dockerfile"
ENVFILE='/home/dokku/oca/ENV'
env_list='ENV'
# itterate through ENV file to make a single line for use in Dockerfile
while read line; do
# Remove the 'export ' at the beginning of each line
lineenv=${line:7}
env_list="$env_list $lineenv"
done <$ENVFILE
# Get teh dockerfile in var so we can look for the "tag"
dfile=`cat $DOCKERFILE`
if [[ "$dfile" =~ "#dokkuEnv#" ]]
then
# use pipes instead of / for splitter b/c backslash might be used in $ENVFILE
sed -i "s|#dokkuEnv#|${env_list}|g" "$DOCKERFILE"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment