Created
February 27, 2015 18:04
-
-
Save that0n3guy/e392d763df4b21c04fd3 to your computer and use it in GitHub Desktop.
dokku build with variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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