Created
October 14, 2015 08:52
-
-
Save k2wanko/5ce46380afded67a6805 to your computer and use it in GitHub Desktop.
docker-build.sh
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/sh | |
remote="" | |
user=$(git remote -v | grep push | awk '{print $2}' | sed -e "s/.*:\(.*\)\/.*/\1/") | |
repository=$(git remote -v | grep push | awk '{print $2}' | sed -e "s/.*docker-\(.*\)\..*/\1/") | |
target=$user/$repository | |
if [ -n "$remote" ];then | |
target=$remote/$target | |
fi | |
root=$(pwd) | |
for f in $(find . -follow -name "Dockerfile"); do | |
cd $(dirname $f) | |
tag=$(echo $f | sed -e "s/\.\/\(.*\)\/.*/\1/") | |
docker build -t $target:$tag . | |
cd $root | |
done | |
docker push $target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment