5 echo >&2 "usage: $0 [options]"
8 echo >&2 " -t, --tags [csv_tags] comma separated tags"
9 echo >&2 " -u, --upload Upload the images (docker push)"
10 echo >&2 " -h, --help Display this help and exit"
12 echo >&2 " If no options are given, just builds the images."
17 # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros).
18 TEMP=`getopt -o hut: \
19 --long help,upload,tags: \
22 if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi
23 # Note the quotes around `$TEMP': they are essential!
36 echo "ERROR: --tags needs a parameter";
63 printf "\n%*s\n\n" $(((${#title}+$COLUMNS)/2)) "********** $1 **********"
69 for tag in $( echo $tags|tr "," " " )
71 $DOCKER tag $1 $1:$tag
75 # Sometimes docker push fails; retry it a few times if necessary.
76 for i in `seq 1 5`; do
79 if [[ "$ECODE" == "0" ]]; then
84 if [[ "$ECODE" != "0" ]]; then
85 title "!!!!!! docker push $* failed !!!!!!"
86 EXITCODE=$(($EXITCODE + $ECODE))
95 echo -n "$(($SECONDS - $t0))s"
99 if ! [[ -n "$WORKSPACE" ]]; then
101 echo >&2 "Error: WORKSPACE environment variable not set"
108 # find the docker binary
109 DOCKER=`which docker.io`
111 if [[ "$DOCKER" == "" ]]; then
112 DOCKER=`which docker`
115 if [[ "$DOCKER" == "" ]]; then
116 title "Error: you need to have docker installed. Could not find the docker executable."
121 title "Starting docker build"
125 # clean up the docker build environment
132 # Get test config.yml file
133 cp $HOME/docker/config.yml .
139 if [[ "$ECODE" != "0" ]]; then
140 title "!!!!!! docker BUILD FAILED !!!!!!"
141 EXITCODE=$(($EXITCODE + $ECODE))
144 title "docker build complete (`timer`)"
146 title "uploading images"
150 if [[ "$ECODE" != "0" ]]; then
151 title "upload arvados images SKIPPED because build failed"
153 if [[ $upload == true ]]; then
154 ## 20150526 nico -- *sometimes* dockerhub needs re-login
155 ## even though credentials are already in .dockercfg
156 docker login -u arvados
159 docker_push arvados/api
160 docker_push arvados/compute
161 docker_push arvados/doc
162 docker_push arvados/workbench
163 docker_push arvados/keep
164 docker_push arvados/keepproxy
165 docker_push arvados/shell
166 docker_push arvados/sso
167 title "upload arvados images complete (`timer`)"
169 title "upload arvados images SKIPPED because no --upload option set"
173 title "Starting docker java-bwa-samtools build"
177 ./build.sh java-bwa-samtools-image
181 if [[ "$ECODE" != "0" ]]; then
182 title "!!!!!! docker java-bwa-samtools BUILD FAILED !!!!!!"
183 EXITCODE=$(($EXITCODE + $ECODE))
186 title "docker build java-bwa-samtools complete (`timer`)"
190 if [[ "$ECODE" != "0" ]]; then
191 title "upload arvados/jobs image SKIPPED because build failed"
193 if [[ $upload == true ]]; then
194 title "upload arvados/jobs image"
195 docker_push arvados/jobs
196 title "upload arvados/jobs image complete (`timer`)"
198 title "upload arvados images SKIPPED because no --upload option set"