-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
build.sh
executable file
·168 lines (131 loc) · 5.64 KB
/
build.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/usr/bin/env bash
set -euxfo pipefail;
case "${1:-x}" in
8x_2) declare -r series="8x_2" ;;
8x_1) declare -r series="8x_1" ;;
8x) declare -r series="8x" ;;
7x) declare -r series="7x" ;;
6x) declare -r series="6x" ;;
snapshot) declare -r series="snapshot" ;;
*) echo "usage: $0 [6x|7x|8x|8x_1|8x_2|snapshot]"
exit 1
;;
esac
source "_common.sh";
build_base () {
docker image build \
--file "base.Dockerfile" \
--tag "base" \
.;
}
build () {
declare -r dockerfile_name="${1}";
declare -r installer_url="${2}";
declare -r version="${3}";
declare -r image_name="${4}";
declare -r tag="${DOCKER_REPOSITORY}:${image_name}";
declare -r secondary_tag="${SECONDARY_DOCKER_REPOSITORY}:${image_name}";
docker image build \
--file "${dockerfile_name}.Dockerfile" \
--tag "${DOCKER_REPOSITORY}:${image_name}" \
--build-arg "RACKET_INSTALLER_URL=${installer_url}" \
--build-arg "RACKET_VERSION=${version}" \
.;
docker image tag "${tag}" "${secondary_tag}";
};
installer_url () {
declare -r version="${1}";
declare -r installer_path="${2}";
echo "https://download.racket-lang.org/installers/${version}/${installer_path}";
};
build_snapshot () {
declare -r version="snapshot";
declare -r installer="https://users.cs.utah.edu/plt/snapshots/current/installers/racket-minimal-current-x86_64-linux-jesse.sh";
build "racket" "${installer}" "${version}" "${version}";
declare -r bc_installer="https://users.cs.utah.edu/plt/snapshots/current/installers/racket-minimal-current-x86_64-linux-bc.sh";
build "racket" "${bc_installer}" "${version}" "${version}-bc";
declare -r full_installer="https://users.cs.utah.edu/plt/snapshots/current/installers/racket-current-x86_64-linux-jesse.sh";
build "racket" "${full_installer}" "${version}" "${version}-full";
declare -r full_bc_installer="https://users.cs.utah.edu/plt/snapshots/current/installers/racket-current-x86_64-linux-bc.sh";
build "racket" "${full_bc_installer}" "${version}" "${version}-bc-full";
}
build_8x () {
declare -r version="${1}";
declare -r installer_path="racket-minimal-${version}-x86_64-linux-natipkg.sh";
declare -r installer=$(installer_url "${version}" "${installer_path}") || exit "${?}";
build "racket" "${installer}" "${version}" "${version}";
declare -r bc_installer_path="racket-minimal-${version}-x86_64-linux-bc.sh";
declare -r bc_installer=$(installer_url "${version}" "${bc_installer_path}") || exit "${?}";
build "racket" "${bc_installer}" "${version}" "${version}-bc";
declare -r full_installer_path="racket-${version}-x86_64-linux-natipkg.sh";
declare -r full_installer=$(installer_url "${version}" "${full_installer_path}") || exit "${?}";
build "racket" "${full_installer}" "${version}" "${version}-full";
declare -r full_bc_installer_path="racket-${version}-x86_64-linux-bc.sh";
declare -r full_bc_installer=$(installer_url "${version}" "${full_bc_installer_path}") || exit "${?}";
build "racket" "${full_bc_installer}" "${version}" "${version}-bc-full";
};
build_7x () {
declare -r version="${1}";
declare -r installer_path="racket-minimal-${version}-x86_64-linux-natipkg.sh";
declare -r installer=$(installer_url "${version}" "${installer_path}") || exit "${?}";
build "racket" "${installer}" "${version}" "${version}";
declare -r cs_installer_path="racket-minimal-${version}-x86_64-linux-natipkg-cs.sh";
declare -r cs_installer=$(installer_url "${version}" "${cs_installer_path}") || exit "${?}";
build "racket" "${cs_installer}" "${version}" "${version}-cs";
declare -r full_installer_path="racket-${version}-x86_64-linux-natipkg.sh";
declare -r full_installer=$(installer_url "${version}" "${full_installer_path}") || exit "${?}";
build "racket" "${full_installer}" "${version}" "${version}-full";
declare -r full_cs_installer_path="racket-${version}-x86_64-linux-natipkg-cs.sh";
declare -r full_cs_installer=$(installer_url "${version}" "${full_cs_installer_path}") || exit "${?}";
build "racket" "${full_cs_installer}" "${version}" "${version}-cs-full";
};
build_6x_7x_old () {
declare -r version="${1}";
declare -r installer_path="racket-minimal-${version}-x86_64-linux-natipkg.sh";
declare -r installer=$(installer_url "${version}" "${installer_path}") || exit "${?}";
build "racket" "${installer}" "${version}" "${version}";
declare -r full_installer_path="racket-${version}-x86_64-linux-natipkg.sh";
declare -r full_installer=$(installer_url "${version}" "${full_installer_path}") || exit "${?}";
build "racket" "${full_installer}" "${version}" "${version}-full";
};
foreach () {
declare -r command="${1}";
declare -r args=("${@:2}");
for _arg in "${args[@]}"; do
"${command}" "${_arg}";
done;
};
declare -r LATEST_RACKET_VERSION="8.14";
tag_latest () {
declare -r repository="${1}";
docker image tag "${repository}:${LATEST_RACKET_VERSION}" "${repository}:latest";
};
# The 8x series is split into two to avoid running into storage limits in CI.
build_8x_2 () {
foreach build_8x "8.10" "8.11" "8.11.1" "8.12" "8.13" "8.14";
tag_latest "${DOCKER_REPOSITORY}";
tag_latest "${SECONDARY_DOCKER_REPOSITORY}";
}
build_8x_1 () {
foreach build_8x "8.0" "8.1" "8.2" "8.3" "8.4" "8.5" "8.6" "8.7" "8.8" "8.9";
}
build_all_8x () {
build_8x_1;
build_8x_2;
}
build_all_7x () {
foreach build_6x_7x_old "7.0" "7.1" "7.3";
foreach build_7x "7.4" "7.5" "7.6" "7.7" "7.8" "7.9";
}
build_all_6x () {
foreach build_6x_7x_old "6.5" "6.6" "6.7" "6.8" "6.9" "6.10" "6.10.1" "6.11" "6.12";
}
build_base;
case "$series" in
8x_2) build_8x_2 ;;
8x_1) build_8x_1 ;;
8x) build_all_8x ;;
7x) build_all_7x ;;
6x) build_all_6x ;;
snapshot) build_snapshot ;;
esac