-
Notifications
You must be signed in to change notification settings - Fork 3
/
build
executable file
·73 lines (57 loc) · 1.41 KB
/
build
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
#!/usr/bin/env bash
set -e
DIR=$(cd `dirname $0` && pwd)
AVAILABLE_SDKS=("csharp dotnet java node php python ruby")
SELECTED_SDK=$1
main() {
touch "${DIR}/data.json"
if [[ -z "${SELECTED_SDK}" ]]; then
show_help
exit 0
fi
# lowercase
SELECTED_SDK="${SELECTED_SDK,,}"
if [[ ${SELECTED_SDK} == "all" ]]; then
build_container node
build_container php
build_container python
build_container ruby
build_container java
build_container dotnet
exit 0
fi
if [[ ${SELECTED_SDK} == "csharp" ]]; then
SELECTED_SDK="dotnet"
fi
if [[ ! " ${AVAILABLE_SDKS[*]} " =~ " ${SELECTED_SDK} " ]]; then
printf "Invalid SDK selected: ${SELECTED_SDK}\n"
show_help
exit 1
fi
build_container ${SELECTED_SDK}
exit 0
}
function show_help() {
cat << EOF
Builds one or all SDK containers.
To create containers for all the SDKs:
./build all
To create a container for a single SDK:
./build [SDK]
SDK can be one of "dotnet", "java", "node", "php", "python", "ruby"
EOF
}
function build_container()
{
SELECTED_SDK=$1
IMG_NAME="dropbox/sign-${SELECTED_SDK}"
printf "Building the ${SELECTED_SDK} container\n\n"
docker image build \
--no-cache \
-t ${IMG_NAME}:latest \
-f data_${SELECTED_SDK}/Dockerfile \
./data_${SELECTED_SDK}
printf "\nSuccessfully created image ${IMG_NAME}\n"
}
main "$@";
exit