forked from eclipse-che/che-theia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_image_build.include
96 lines (89 loc) · 3.12 KB
/
docker_image_build.include
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
# Copyright (c) 2019 Red Hat, Inc.
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
set -e
set -u
IMAGE_TAG="next"
THEIA_VERSION="master"
THEIA_BRANCH="master"
THEIA_GIT_REFS="refs\\/heads\\/master"
THEIA_DOCKER_IMAGE_VERSION=
# KEEP RIGHT ORDER!!!
PR_IMAGES=(
dockerfiles/theia-dev
dockerfiles/theia
dockerfiles/theia-endpoint-runtime
)
# KEEP RIGHT ORDER!!!
DOCKER_FILES_LOCATIONS=(
dockerfiles/theia-dev
dockerfiles/theia
dockerfiles/theia-endpoint-runtime
dockerfiles/remote-plugin-java8
dockerfiles/remote-plugin-java11
dockerfiles/remote-plugin-php7
dockerfiles/remote-plugin-go-1.10.7
dockerfiles/remote-plugin-clang-8
dockerfiles/remote-plugin-python-3.7.3
dockerfiles/remote-plugin-dotnet-2.2.105
dockerfiles/remote-plugin-kubernetes-tooling-0.1.17
dockerfiles/remote-plugin-kubernetes-tooling-1.0.0
dockerfiles/remote-plugin-openshift-connector-0.0.17
dockerfiles/remote-plugin-openshift-connector-0.0.21
dockerfiles/remote-plugin-dependency-analytics-0.0.12
)
IMAGES_LIST=(
eclipse/che-theia-dev
eclipse/che-theia
eclipse/che-theia-endpoint-runtime
eclipse/che-remote-plugin-runner-java8
eclipse/che-remote-plugin-runner-java11
eclipse/che-remote-plugin-php7
eclipse/che-remote-plugin-go-1.10.7
eclipse/che-remote-plugin-clang-8
eclipse/che-remote-plugin-python-3.7.3
eclipse/che-remote-plugin-dotnet-2.2.105
eclipse/che-remote-plugin-kubernetes-tooling-0.1.17
eclipse/che-remote-plugin-kubernetes-tooling-1.0.0
eclipse/che-remote-plugin-openshift-connector-0.0.17
eclipse/che-remote-plugin-openshift-connector-0.0.21
eclipse/che-remote-plugin-dependency-analytics-0.0.12
)
buildImages() {
IMG_LIST=("$@")
for image_dir in "${IMG_LIST[@]}"
do
GITHUB_TOKEN_ARG="GITHUB_TOKEN="${GITHUB_TOKEN}
if [ "$image_dir" == "dockerfiles/theia" ]; then
bash $(pwd)/$image_dir/build.sh --build-args:${GITHUB_TOKEN_ARG},THEIA_VERSION=${THEIA_VERSION} --tag:${IMAGE_TAG} --branch:${THEIA_BRANCH} --git-ref:${THEIA_GIT_REFS}
elif [ "$image_dir" == "dockerfiles/theia-dev" ]; then
bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG}
else
bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG}
fi
if [ $? -ne 0 ]; then
echo "ERROR:"
echo "build of '$image_dir' image is failed!"
exit 1
fi
done
}
publishImages() {
IMG_LIST=("$@")
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
for image in "${IMG_LIST[@]}"
do
if [ ! -z ${THEIA_DOCKER_IMAGE_VERSION} ]; then
docker tag ${image}:${IMAGE_TAG} ${image}:${THEIA_DOCKER_IMAGE_VERSION}
echo y | docker push ${image}:${IMAGE_TAG}
echo y | docker push ${image}:${THEIA_DOCKER_IMAGE_VERSION}
else
echo y | docker push ${image}:${IMAGE_TAG}
fi
done
}