Skip to content

Commit d37a249

Browse files
committed
Switch from Ubuntu to Debian
Specifically, from Ubuntu Jammy (22.04; EOL in 2027) to Debian Bookworm (12; EOL in 2028). Ideally we would upgrade to Debian Trixie (13; EOL in 2030), but that gets us too new of a Python for `cqlsh` 😔
1 parent a02e9c1 commit d37a249

7 files changed

Lines changed: 83 additions & 42 deletions

File tree

4.0/Dockerfile

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

4.1/Dockerfile

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

5.0/Dockerfile

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile.template

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM {{ .FROM.version }}
1+
FROM debian:bookworm-slim
22

33
# explicitly set user/group IDs
44
RUN set -eux; \
@@ -50,6 +50,11 @@ RUN set -eux; \
5050
gosu --version; \
5151
gosu nobody true
5252

53+
ENV JAVA_HOME /opt/java/openjdk
54+
COPY --from=eclipse-temurin:{{ .java.version }}-jre $JAVA_HOME $JAVA_HOME
55+
ENV PATH $JAVA_HOME/bin:$PATH
56+
RUN java --version
57+
5358
ENV CASSANDRA_HOME /opt/cassandra
5459
ENV CASSANDRA_CONF /etc/cassandra
5560
ENV PATH $CASSANDRA_HOME/bin:$PATH

generate-stackbrew-library.sh

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,36 @@ dirCommit() {
3939
)
4040
}
4141

42+
gawkParents='
43+
{ cmd = toupper($1) }
44+
cmd == "FROM" {
45+
print $2
46+
next
47+
}
48+
cmd == "COPY" {
49+
for (i = 2; i < NF; i++) {
50+
if ($i ~ /^--from=/) {
51+
gsub(/^--from=/, "", $i)
52+
print $i
53+
next
54+
}
55+
}
56+
}
57+
'
58+
4259
getArches() {
4360
local repo="$1"; shift
4461
local officialImagesBase="${BASHBREW_LIBRARY:-https://github.com/docker-library/official-images/raw/HEAD/library}/"
4562

4663
local parentRepoToArchesStr
4764
parentRepoToArchesStr="$(
48-
find -name 'Dockerfile' -exec awk -v officialImagesBase="$officialImagesBase" '
49-
toupper($1) == "FROM" && $2 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
50-
printf "%s%s\n", officialImagesBase, $2
51-
}
52-
' '{}' + \
65+
find -name 'Dockerfile' -exec gawk "$gawkParents" '{}' + \
5366
| sort -u \
67+
| gawk -v officialImagesBase="$officialImagesBase" '
68+
$1 !~ /^('"$repo"'|scratch|.*\/.*)(:|$)/ {
69+
printf "%s%s\n", officialImagesBase, $1
70+
}
71+
' \
5472
| xargs -r bashbrew cat --format '["{{ .RepoName }}:{{ .TagName }}"]="{{ join " " .TagEntry.Architectures }}"'
5573
)"
5674
eval "declare -g -A parentRepoToArches=( $parentRepoToArchesStr )"
@@ -83,13 +101,27 @@ for version; do
83101
fi
84102
versionAliases+=( ${aliases[$version]:-} )
85103

86-
suite="$(jq -r '.[env.version].FROM.base' versions.json)"
104+
suite="$(jq -r '.[env.version].debian.version' versions.json)"
87105
suiteAliases=( "${versionAliases[@]/%/-$suite}" )
88106
suiteAliases=( "${suiteAliases[@]//latest-/}" )
89107
versionAliases+=( "${suiteAliases[@]}" )
90108

91-
parent="$(awk 'toupper($1) == "FROM" { print $2 }' "$version/Dockerfile")"
92-
arches="${parentRepoToArches[$parent]}"
109+
parents="$(gawk "$gawkParents" "$version/Dockerfile")"
110+
arches=
111+
for parent in $parents; do
112+
parentArches="${parentRepoToArches[$parent]:-}"
113+
if [ -z "$parentArches" ]; then
114+
continue
115+
elif [ -z "$arches" ]; then
116+
arches="$parentArches"
117+
else
118+
arches="$(
119+
comm -12 \
120+
<(xargs -n1 <<<"$arches" | sort -u) \
121+
<(xargs -n1 <<<"$parentArches" | sort -u)
122+
)"
123+
fi
124+
done
93125

94126
commit="$(dirCommit "$version")"
95127

versions.json

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
"java": {
66
"version": "11"
77
},
8-
"FROM": {
9-
"version": "eclipse-temurin:11-jre-jammy",
10-
"base": "jammy"
8+
"debian": {
9+
"version": "bookworm"
1110
}
1211
},
1312
"4.1": {
@@ -16,9 +15,8 @@
1615
"java": {
1716
"version": "11"
1817
},
19-
"FROM": {
20-
"version": "eclipse-temurin:11-jre-jammy",
21-
"base": "jammy"
18+
"debian": {
19+
"version": "bookworm"
2220
}
2321
},
2422
"5.0": {
@@ -27,9 +25,8 @@
2725
"java": {
2826
"version": "17"
2927
},
30-
"FROM": {
31-
"version": "eclipse-temurin:17-jre-jammy",
32-
"base": "jammy"
28+
"debian": {
29+
"version": "bookworm"
3330
}
3431
}
3532
}

versions.sh

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,22 @@ set -Eeuo pipefail
33

44
# https://cassandra.apache.org/doc/5.0/cassandra/installing/installing.html#prerequisites
55
# https://cassandra.apache.org/doc/4.1/cassandra/getting_started/installing.html#prerequisites
6+
# https://github.com/apache/cassandra/blob/cassandra-5.0.6/build.xml#L48
67
defaultJavaVersion='17'
78
declare -A javaVersions=(
8-
[4.0]='11'
9-
[4.1]='11'
9+
[4.0]='11' # https://github.com/apache/cassandra/blob/cassandra-4.0.19/build.xml#L212-L221
10+
[4.1]='11' # https://github.com/apache/cassandra/blob/cassandra-4.1.10/build.xml#L227-L236
1011
)
11-
declare -A suiteOverrides=(
12+
defaultSuite='trixie'
13+
declare -A suites=(
1214
# https://issues.apache.org/jira/browse/CASSANDRA-19206: "cqlsh breaks with Python 3.12" ("ModuleNotFoundError: No module named 'six.moves'")
13-
[4.0]='jammy'
14-
[4.1]='jammy'
15+
[4.0]='bookworm'
16+
[4.1]='bookworm'
1517
# "Warning: unsupported version of Python, required 3.6-3.11 but found 3.12"
1618
# https://github.com/apache/cassandra/commit/8fd44ca8fc9e0b0e94932bcd855e2833bf6ca3cb#diff-8d8ae48aaf489a8a0e726d3e4a6230a26dcc76e7c739e8e3968e3f65c995d148
1719
# https://issues.apache.org/jira/browse/CASSANDRA-19245?focusedCommentId=17803539#comment-17803539
1820
# https://github.com/apache/cassandra/blob/cassandra-5.0.6/bin/cqlsh#L65
19-
[5.0]='jammy'
21+
[5.0]='bookworm'
2022
)
2123

2224
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
@@ -55,18 +57,10 @@ for version in "${versions[@]}"; do
5557
fi
5658
export fullVersion sha512
5759

58-
export javaVersion="${javaVersions[$version]:-$defaultJavaVersion}"
59-
suiteOverride="${suiteOverrides[$version]:-}"
60+
export javaVersion="${javaVersions[$version]:-$defaultJavaVersion}" # TODO scrape this from build.xml upstream directly?
61+
export suite="${suites[$version]:-$defaultSuite}"
6062

61-
# for the given Java version, find the "default" Eclipse Temurin tag with stable specificity ("X-jre-SUITE")
62-
from="$(
63-
bashbrew --arch amd64 list --arch-filter "https://github.com/docker-library/official-images/raw/HEAD/library/eclipse-temurin:$javaVersion-jre${suiteOverride:+-$suiteOverride}" \
64-
| grep -F ":$javaVersion-jre-" \
65-
| tail -1
66-
)"
67-
export from
68-
69-
echo "$version: $fullVersion (FROM $from)"
63+
echo "$version: $fullVersion"
7064

7165
json="$(jq <<<"$json" -c '
7266
.[env.version] = {
@@ -75,10 +69,8 @@ for version in "${versions[@]}"; do
7569
java: {
7670
version: env.javaVersion,
7771
},
78-
FROM: {
79-
# this structure is a little bit awkward, but gives us nice commit messages like "Update 5.0 to FROM eclipse-temurin:17-jre-jammy"
80-
version: env.from,
81-
base: (env.from | split(":\(env.javaVersion)-jre-")[1]),
72+
debian: {
73+
version: env.suite,
8274
},
8375
}
8476
')"

0 commit comments

Comments
 (0)