Signed-off-by: Jess Frazelle <me@jessfraz.com>
This commit is contained in:
Jess Frazelle 2016-09-20 18:41:21 -07:00
parent aab90b457e
commit 4d28fafe1e
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3

View File

@ -1,12 +1,16 @@
#!/bin/bash #!/bin/bash
set -e set -e
set -o pipefail
REPO_URL="${REPO_URL:-r.j3ss.co}"
build_and_push(){ build_and_push(){
base=$1 base=$1
suite=$2 suite=$2
build_dir=$3 build_dir=$3
docker build --rm --force-rm -t r.j3ss.co/${base}:${suite} ${build_dir} || return 1 echo "Building ${REPO_URL}/${base}:${suite} for context ${build_dir}"
docker build --rm --force-rm -t ${REPO_URL}/${base}:${suite} ${build_dir} || return 1
# on successful build, push the image # on successful build, push the image
echo " --- " echo " --- "
@ -17,7 +21,7 @@ build_and_push(){
# absolutely no reason # absolutely no reason
n=0 n=0
until [ $n -ge 5 ]; do until [ $n -ge 5 ]; do
docker push --disable-content-trust=false r.j3ss.co/${base}:${suite} && break docker push --disable-content-trust=false ${REPO_URL}/${base}:${suite} && break
echo "Try #$n failed... sleeping for 15 seconds" echo "Try #$n failed... sleeping for 15 seconds"
n=$[$n+1] n=$[$n+1]
sleep 15 sleep 15
@ -25,15 +29,15 @@ build_and_push(){
# also push the tag latest for "stable" tags # also push the tag latest for "stable" tags
if [[ "$suite" == "stable" ]]; then if [[ "$suite" == "stable" ]]; then
docker tag r.j3ss.co/${base}:${suite} r.j3ss.co/${base}:latest docker tag ${REPO_URL}/${base}:${suite} ${REPO_URL}/${base}:latest
docker push --disable-content-trust=false r.j3ss.co/${base}:latest docker push --disable-content-trust=false ${REPO_URL}/${base}:latest
fi fi
} }
main(){ main(){
# get the dockerfiles # get the dockerfiles
IFS=$'\n' IFS=$'\n'
files=( $(find . -iname '*Dockerfile' | sed 's|./||') ) files=( $(find . -iname '*Dockerfile' | sed 's|./||' | sort) )
unset IFS unset IFS
ERRORS=() ERRORS=()