1
+ #! /usr/bin/env bash
2
+
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership.
6
+ # The ASF licenses this file to You under the Apache License, Version 2.0
7
+ # (the "License"); you may not use this file except in compliance with
8
+ # the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ # This script builds and pushes docker images when run from a release of Spark
20
+ # with Kubernetes support.
21
+
22
+ declare -A path=( [spark-driver]=dockerfiles/driver/Dockerfile \
23
+ [spark-executor]=dockerfiles/executor/Dockerfile \
24
+ [spark-driver-py]=dockerfiles/driver-py/Dockerfile \
25
+ [spark-executor-py]=dockerfiles/executor-py/Dockerfile \
26
+ [spark-init]=dockerfiles/init-container/Dockerfile \
27
+ [spark-shuffle]=dockerfiles/shuffle-service/Dockerfile \
28
+ [spark-resource-staging-server]=dockerfiles/resource-staging-server/Dockerfile )
29
+
30
+ function build {
31
+ docker build -t spark-base -f dockerfiles/spark-base/Dockerfile .
32
+ for image in " ${! path[@]} " ; do
33
+ docker build -t ${REPO} /$image :${TAG} -f ${path[$image]} .
34
+ done
35
+ }
36
+
37
+
38
+ function push {
39
+ for image in " ${! path[@]} " ; do
40
+ docker push ${REPO} /$image :${TAG}
41
+ done
42
+ }
43
+
44
+ function usage {
45
+ echo " Usage: ./sbin/build-push-docker-images.sh -r <repo> -t <tag> build"
46
+ echo " ./sbin/build-push-docker-images.sh -r <repo> -t <tag> push"
47
+ echo " for example: ./sbin/build-push-docker-images.sh -r docker.io/kubespark -t v2.2.0 push"
48
+ }
49
+
50
+ if [[ " $@ " = * --help ]] || [[ " $@ " = * -h ]]; then
51
+ usage
52
+ exit 0
53
+ fi
54
+
55
+ while getopts r:t: option
56
+ do
57
+ case " ${option} "
58
+ in
59
+ r) REPO=${OPTARG} ;;
60
+ t) TAG=${OPTARG} ;;
61
+ esac
62
+ done
63
+
64
+ if [ -z " $REPO " ] || [ -z " $TAG " ]; then
65
+ usage
66
+ else
67
+ case " ${@: -1} " in
68
+ build) build;;
69
+ push) push;;
70
+ * ) usage;;
71
+ esac
72
+ fi
0 commit comments