comparison docker_legacy/do_all.sh @ 164:29873a41aae1

docker: new docker files are now in sat main repos, this one is legacy
author Goffi <goffi@goffi.org>
date Fri, 01 Jan 2021 18:33:52 +0100
parents
children
comparison
equal deleted inserted replaced
163:a63f6d360326 164:29873a41aae1
1 #!/bin/sh
2
3 # This script build all container in the right order
4 # Copyright (C) 2014 Jérôme Poisson (goffi@goffi.org)
5
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
15
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 DIRS="base media sat_nomedia sat jp primitivus sat_pubsub prosody salut libervia data"
20 ACCOUNT="salutatoi"
21
22 ori_dir=$(pwd)
23
24 if [ $# -eq 0 ]; then
25 cmd="build"
26 else
27 case $1 in
28 build)
29 cmd="build"
30 BEFORE="-t"
31 AFTER="."
32 ;;
33 push)
34 cmd="push"
35 TAG=":latest"
36 ;;
37 pull)
38 cmd="pull"
39 TAG=":latest"
40 ;;
41 *)
42 printf "Invalid command ($1)\n"
43 exit 1
44 ;;
45 esac
46
47 shift
48 fi
49
50 for cont_dir in $DIRS; do
51 cont_name=$(grep -o "Salut à Toi/[^ ]\+" $cont_dir/Dockerfile | sed "s&Salut à Toi/&&" | tr '[:upper:]' '[:lower:]')
52 cd "$cont_dir"
53 printf "\n==> Doing a $cmd for $ACCOUNT/$cont_name in $cont_dir with extra [$@] <===\n\n"
54 docker $cmd $BEFORE "$ACCOUNT/${cont_name}${TAG}" "$@" $AFTER
55 err=$?
56 cd "$ori_dir"
57 if [ $err -ne 0 ]; then
58 printf "$cmd of $cont_name failed (exit code $err), exiting\n"
59 exit 1
60 fi
61 done