a8d7461a by Adam Heath

Add options to build.sh to allow setting the various parameters.

1 parent 2503bedb
Showing 1 changed file with 28 additions and 3 deletions
...@@ -3,20 +3,45 @@ ...@@ -3,20 +3,45 @@
3 TAG=test-latest 3 TAG=test-latest
4 APP=moqui-app 4 APP=moqui-app
5 PUSH_TO=docker://5.161.91.120:31234 5 PUSH_TO=docker://5.161.91.120:31234
6 declare -a images=(moqui-jdbc-drivers moqui-app moqui-jdbc-drivers) 6 PREFIX=
7 declare -a images=(moqui-jdbc-drivers moqui-app)
7 8
8 _build() { 9 _build() {
9 for image in "${images[@]}"; do 10 for image in "${images[@]}"; do
10 docker build -f Dockerfile --tag "${image}:${TAG}" --target "${image}" "${APP}" 11 docker build -f Dockerfile --tag "${PREFIX}${image}:${TAG}" --target "${image}" "${APP}"
11 done 12 done
12 } 13 }
13 14
14 _push() { 15 _push() {
15 for image in "${images[@]}"; do 16 for image in "${images[@]}"; do
16 skopeo copy --dest-tls-verify=false "docker-daemon:${image}:${TAG}" "${PUSH_TO}/${image}:${TAG}" 17 echo "Pushing ${PREFIX}${image}:${TAG} to ${PUSH_TO}/${image}:${TAG}"
18 skopeo copy --dest-tls-verify=false "docker-daemon:${PREFIX}${image}:${TAG}" "${PUSH_TO}/${image}:${TAG}"
17 done 19 done
18 } 20 }
19 21
22 while [[ $# -gt 0 ]]; do
23 case "$1" in
24 (--app)
25 APP="$2"
26 shift 2
27 ;;
28 (--prefix)
29 PREFIX="$2"
30 shift 2
31 ;;
32 (--push-to)
33 PUSH_TO="$2"
34 shift 2
35 ;;
36 (--tag)
37 TAG="$2"
38 shift 2
39 ;;
40 (*)
41 break
42 ;;
43 esac
44 done
20 case "$1" in 45 case "$1" in
21 (build) 46 (build)
22 _build 47 _build
......