-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild_deploy.sh
executable file
·98 lines (82 loc) · 2.68 KB
/
build_deploy.sh
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
97
98
#!/bin/bash
# abort on errors and on unset variables
set -e -o nounset
SDKS=$(echo {31..31})
LATEST_SDKS=$(echo {31..29})
LATEST_PACKAGES=''; for SDK in $LATEST_SDKS; do LATEST_PACKAGES="platforms;android-${SDK} $LATEST_PACKAGES"; done
PARALLEL=false
DRY_RUN=false
echo "SDKS = $SDKS"
echo "LATEST_SDKS = $LATEST_SDKS"
echo "LATEST_PACKAGES = $LATEST_PACKAGES"
docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
docker_push() {
if $DRY_RUN; then
echo "Dry run: docker push $1"
else
docker push $1
fi
}
build_deploy_minimal() {
echo "Building 'minimal' image…"
docker build --tag mreichelt/android:minimal --file minimal.Dockerfile .
docker_push mreichelt/android:minimal
echo
}
build_deploy_base() {
echo "Building 'base' image…"
docker build --tag mreichelt/android:base --file base.Dockerfile .
docker_push mreichelt/android:base
echo
}
build_deploy_base_ndk() {
echo "Building 'base-ndk' image…"
docker build --tag mreichelt/android:base-ndk --file base-ndk.Dockerfile .
docker_push mreichelt/android:base-ndk
echo
}
build_deploy_latest() {
echo "Building 'latest' image…"
docker build --tag mreichelt/android:latest --build-arg "latest_packages=${LATEST_PACKAGES}" --file latest.Dockerfile .
docker_push mreichelt/android:latest
echo
}
build_deploy_latest_ndk() {
echo "Building 'latest-ndk' image…"
docker build --tag mreichelt/android:latest-ndk --file latest-ndk.Dockerfile .
docker_push mreichelt/android:latest-ndk
echo
}
build_deploy_sdk_and_system() {
sdk=$1
echo "Building '$sdk' image…"
docker build --tag mreichelt/android:$sdk --build-arg android_sdk_version=$sdk --file sdk.Dockerfile .
echo "Pushing '$sdk' image…"
docker_push mreichelt/android:$sdk
echo
echo "Building '$sdk-system' image…"
docker build --tag mreichelt/android:$sdk-system --build-arg android_sdk_version=$sdk --file sdk-system.Dockerfile .
echo "Pushing '$sdk-system' image…"
docker_push mreichelt/android:$sdk-system
echo
echo "Deleting images '$sdk' and '$sdk-system'"
docker rmi mreichelt/android:$sdk mreichelt/android:$sdk-system
}
build_deploy_minimal
build_deploy_base
build_deploy_latest
build_deploy_base_ndk
build_deploy_latest_ndk
# build all sdk + system variants (in parallel because TravisCI has a 50m timeout)
case $PARALLEL in
(true)
export -f build_deploy_sdk_and_system
SHELL=$(type -p bash) parallel -j 2 --keep-order --line-buffer echo Building SDK {}\; build_deploy_sdk_and_system {} ::: $SDKS
;;
(false)
for SDK in $SDKS; do
echo Building SDK $SDK
build_deploy_sdk_and_system $SDK
done
;;
esac