Skip to content

Commit ab34e0f

Browse files
authored
Merge pull request #218 from alexander-yakushev/jdk-22
Add JDK 22
2 parents 31b7d3f + 8f935d8 commit ab34e0f

49 files changed

Lines changed: 1379 additions & 14 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ release every 2-3 years. As of 2019-9-25, our images will default to the latest
4545
LTS release of OpenJDK (currently 21). But we also now provide the ability to
4646
specify which version of Java you'd like via Docker tags:
4747

48-
JDK 1.8 tools-deps image: `clojure:temurin-8-tools-deps`
49-
JDK 11 variant of the tools-deps image: `clojure:temurin-11-tools-deps` or `clojure:temurin-11`
50-
JDK 17 with boot 2.8.3: `clojure:temurin-17-boot-2.8.3`
51-
JDK 20 with the latest version of lein: `clojure:temurin-20-lein`
52-
JDK 21 variant of the tools-deps image: `clojure:tools-deps` or `clojure:temurin-21` or `clojure:temurin-21-tools-deps`
48+
JDK 1.8 tools-deps image: `clojure:temurin-8-tools-deps`
49+
JDK 11 variant of the tools-deps image: `clojure:temurin-11-tools-deps` or `clojure:temurin-11`
50+
JDK 17 with boot 2.8.3: `clojure:temurin-17-boot-2.8.3`
51+
JDK 20 with the latest version of lein: `clojure:temurin-20-lein`
52+
JDK 21 variant of the tools-deps image: `clojure:tools-deps` or `clojure:temurin-21` or `clojure:temurin-21-tools-deps`
53+
JDK 22 variant of the tools-deps image: `clojure:temurin-22` or `clojure:temurin-22-tools-deps`
5354

5455
## Linux distro
5556

@@ -82,11 +83,12 @@ You can specify which distro & version you'd like by appending it to the end of
8283
your Docker tag as in the following examples (but note that not every
8384
combination is provided upstream and thus likewise for us):
8485

85-
Java 8 leiningen on Debian bullseye-slim: `clojure:temurin-8-lein-bullseye-slim`
86-
Java 11 leiningen on Debian bullseye: `clojure:temurin-11-lein-bullseye`
87-
Java 17 tools-deps on Ubuntu focal: `clojure:tools-deps` or `clojure:temurin-17` or `clojure:temurin-17-tools-deps` or `clojure:temurin-17-tools-deps-focal`
88-
Java 17 tools-deps on Debian bullseye-slim: `clojure:bullseye-slim` or `clojure:tools-deps-bullseye-slim` or `clojure:temurin-17-bullseye-slim` or `clojure:temurin-17-tools-deps-bullseye-slim`
89-
Java 21 tools-deps on Debian bookworm: `clojure:tools-deps` or `clojure:temurin-21-tools-deps` or `clojure:temurin-21-bookworm`
86+
Java 8 leiningen on Debian bullseye-slim: `clojure:temurin-8-lein-bullseye-slim`
87+
Java 11 leiningen on Debian bullseye: `clojure:temurin-11-lein-bullseye`
88+
Java 17 tools-deps on Ubuntu focal: `clojure:tools-deps` or `clojure:temurin-17` or `clojure:temurin-17-tools-deps` or `clojure:temurin-17-tools-deps-focal`
89+
Java 17 tools-deps on Debian bullseye-slim: `clojure:bullseye-slim` or `clojure:tools-deps-bullseye-slim` or `clojure:temurin-17-bullseye-slim` or `clojure:temurin-17-tools-deps-bullseye-slim`
90+
Java 21 tools-deps on Debian bookworm: `clojure:tools-deps` or `clojure:temurin-21-tools-deps` or `clojure:temurin-21-bookworm`
91+
Java 22 leiningen on Debian bookworm: `clojure:temurin-21-lein-bookworm`
9092

9193
### Alpine Linux
9294

@@ -96,8 +98,8 @@ As of 2022-9-29 these are available for the linux/amd64 architecture only.
9698

9799
Some example tags:
98100

99-
Java 17 leiningen on Alpine: `clojure:temurin-17-alpine` `clojure:temurin-17-lein-alpine`
100-
Java 20 tools-deps on Alpine: `clojure:temurin-20-tools-deps-alpine` or `clojure:temurin-20-alpine`
101+
Java 17 leiningen on Alpine: `clojure:temurin-17-alpine` `clojure:temurin-17-lein-alpine`
102+
Java 21 tools-deps on Alpine: `clojure:temurin-21-tools-deps-alpine` or `clojure:temurin-21-alpine`
101103

102104
## Examples
103105

@@ -144,4 +146,4 @@ linux/arm64).
144146
## Tests
145147

146148
The `docker-clojure` build tool has a test suite that can be run via the
147-
`bb run test` script.
149+
`bb run test` script.

src/docker_clojure/config.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
(def git-repo "https://github.com/Quantisan/docker-clojure.git")
4141

42-
(def jdk-versions #{8 11 17 21})
42+
(def jdk-versions #{8 11 17 21 22})
4343

4444
(def base-images
4545
"Map of JDK version to base image name(s) with :default as a fallback"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM debian:bookworm
2+
3+
ENV JAVA_HOME=/opt/java/openjdk
4+
COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME
5+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
6+
7+
ENV BOOT_VERSION=2.8.3
8+
ENV BOOT_INSTALL=/usr/local/bin/
9+
10+
WORKDIR /tmp
11+
12+
# NOTE: BOOT_VERSION tells the boot.sh script which version of boot to install
13+
# on its first run. We always download the latest version of boot.sh because
14+
# it is just the installer script.
15+
RUN \
16+
apt-get update && \
17+
apt-get install -y make wget && \
18+
rm -rf /var/lib/apt/lists/* && \
19+
mkdir -p $BOOT_INSTALL && \
20+
wget -q https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh && \
21+
echo "Comparing installer checksum..." && \
22+
sha256sum boot.sh && \
23+
echo "0ccd697f2027e7e1cd3be3d62721057cbc841585740d0aaa9fbb485d7b1f17c3 *boot.sh" | sha256sum -c - && \
24+
mv boot.sh $BOOT_INSTALL/boot && \
25+
chmod 0755 $BOOT_INSTALL/boot && \
26+
apt-get purge -y --auto-remove wget
27+
28+
ENV PATH=$PATH:$BOOT_INSTALL
29+
ENV BOOT_AS_ROOT=yes
30+
31+
RUN boot
32+
33+
COPY entrypoint /usr/local/bin/entrypoint
34+
35+
ENTRYPOINT ["entrypoint"]
36+
CMD ["repl"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -eou pipefail
4+
5+
entrypoint=boot
6+
7+
cmd=${1:-}
8+
9+
# check if the first arg starts with a hyphen
10+
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
11+
exec "${entrypoint}" "$@"
12+
fi
13+
14+
if [[ -n "${cmd}" ]]; then
15+
# see if help for the subcommand is successful
16+
if "${entrypoint}" "${cmd}" --help >/dev/null 2>&1; then
17+
exec "${entrypoint}" "$@"
18+
fi
19+
fi
20+
21+
exec "$@"
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM debian:bookworm
2+
3+
ENV JAVA_HOME=/opt/java/openjdk
4+
COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME
5+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
6+
7+
ENV LEIN_VERSION=2.11.2
8+
ENV LEIN_INSTALL=/usr/local/bin/
9+
10+
WORKDIR /tmp
11+
12+
# Download the whole repo as an archive
13+
RUN set -eux; \
14+
apt-get update && \
15+
apt-get install -y make gnupg wget && \
16+
rm -rf /var/lib/apt/lists/* && \
17+
mkdir -p $LEIN_INSTALL && \
18+
wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \
19+
echo "Comparing lein-pkg checksum ..." && \
20+
sha256sum lein-pkg && \
21+
echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \
22+
mv lein-pkg $LEIN_INSTALL/lein && \
23+
chmod 0755 $LEIN_INSTALL/lein && \
24+
export GNUPGHOME="$(mktemp -d)" && \
25+
export FILENAME_EXT=jar && \
26+
gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \
27+
wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \
28+
wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \
29+
echo "Verifying file PGP signature..." && \
30+
gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \
31+
gpgconf --kill all && \
32+
rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \
33+
mkdir -p /usr/share/java && \
34+
mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \
35+
apt-get purge -y --auto-remove gnupg wget
36+
37+
ENV PATH=$PATH:$LEIN_INSTALL
38+
ENV LEIN_ROOT 1
39+
40+
# Install clojure 1.11.1 so users don't have to download it every time
41+
RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \
42+
&& lein deps && rm project.clj
43+
44+
COPY entrypoint /usr/local/bin/entrypoint
45+
46+
ENTRYPOINT ["entrypoint"]
47+
CMD ["repl"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -eou pipefail
4+
5+
entrypoint=lein
6+
7+
cmd=${1:-}
8+
9+
# check if the first arg starts with a hyphen
10+
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
11+
exec "${entrypoint}" "$@"
12+
fi
13+
14+
if [[ -n "${cmd}" ]]; then
15+
# see if help for the subcommand is successful
16+
if "${entrypoint}" "${cmd}" --help >/dev/null 2>&1; then
17+
exec "${entrypoint}" "$@"
18+
fi
19+
fi
20+
21+
exec "$@"
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM debian:bookworm
2+
3+
ENV JAVA_HOME=/opt/java/openjdk
4+
COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME
5+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
6+
7+
ENV CLOJURE_VERSION=1.11.1.1435
8+
9+
WORKDIR /tmp
10+
11+
RUN \
12+
apt-get update && \
13+
apt-get install -y curl make git rlwrap wget && \
14+
rm -rf /var/lib/apt/lists/* && \
15+
wget https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \
16+
sha256sum linux-install-$CLOJURE_VERSION.sh && \
17+
echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \
18+
chmod +x linux-install-$CLOJURE_VERSION.sh && \
19+
./linux-install-$CLOJURE_VERSION.sh && \
20+
rm linux-install-$CLOJURE_VERSION.sh && \
21+
clojure -e "(clojure-version)" && \
22+
apt-get purge -y --auto-remove curl wget
23+
24+
# Docker bug makes rlwrap crash w/o short sleep first
25+
# Bug: https://github.com/moby/moby/issues/28009
26+
# As of 2021-09-10 this bug still exists, despite that issue being closed
27+
COPY rlwrap.retry /usr/local/bin/rlwrap
28+
29+
COPY entrypoint /usr/local/bin/entrypoint
30+
31+
ENTRYPOINT ["entrypoint"]
32+
CMD ["-M", "--repl"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -eou pipefail
4+
5+
entrypoint=clj
6+
7+
cmd=${1:-}
8+
9+
# check if the first arg starts with a hyphen
10+
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
11+
exec "${entrypoint}" "$@"
12+
fi
13+
14+
if [[ -n "${cmd}" ]]; then
15+
# see if help for the subcommand is successful
16+
if "${entrypoint}" "${cmd}" --help >/dev/null 2>&1; then
17+
exec "${entrypoint}" "$@"
18+
fi
19+
fi
20+
21+
exec "$@"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
3+
# This script works around a Docker bug that prevents rlwrap from starting
4+
# right when a container is first started. It is intended to replace
5+
# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH
6+
# (e.g. /usr/local/bin).
7+
8+
max_tries=100 # 100 tries is ~1 second
9+
try=0
10+
11+
while true; do
12+
# see if rlwrap can start at all
13+
output=$(/usr/bin/rlwrap true 2>&1 >/dev/null)
14+
exit_code=$?
15+
if [ $exit_code -gt 0 ]; then
16+
# it didn't start
17+
try=$((try+1))
18+
if [ $try -gt $max_tries ]; then
19+
# we're at max attempts so output the error and exit w/ the same code
20+
echo "$output" >&2
21+
exit $exit_code
22+
else
23+
# wait a bit and try again
24+
sleep 0.01
25+
fi
26+
else
27+
# rlwrap can start so let's run it for real
28+
exec /usr/bin/rlwrap "$@"
29+
fi
30+
done
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM debian:bookworm-slim
2+
3+
ENV JAVA_HOME=/opt/java/openjdk
4+
COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME
5+
ENV PATH="${JAVA_HOME}/bin:${PATH}"
6+
7+
ENV BOOT_VERSION=2.8.3
8+
ENV BOOT_INSTALL=/usr/local/bin/
9+
10+
WORKDIR /tmp
11+
12+
# NOTE: BOOT_VERSION tells the boot.sh script which version of boot to install
13+
# on its first run. We always download the latest version of boot.sh because
14+
# it is just the installer script.
15+
RUN \
16+
apt-get update && \
17+
apt-get install -y wget && \
18+
rm -rf /var/lib/apt/lists/* && \
19+
mkdir -p $BOOT_INSTALL && \
20+
wget -q https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh && \
21+
echo "Comparing installer checksum..." && \
22+
sha256sum boot.sh && \
23+
echo "0ccd697f2027e7e1cd3be3d62721057cbc841585740d0aaa9fbb485d7b1f17c3 *boot.sh" | sha256sum -c - && \
24+
mv boot.sh $BOOT_INSTALL/boot && \
25+
chmod 0755 $BOOT_INSTALL/boot && \
26+
apt-get purge -y --auto-remove wget
27+
28+
ENV PATH=$PATH:$BOOT_INSTALL
29+
ENV BOOT_AS_ROOT=yes
30+
31+
RUN boot
32+
33+
COPY entrypoint /usr/local/bin/entrypoint
34+
35+
ENTRYPOINT ["entrypoint"]
36+
CMD ["repl"]

0 commit comments

Comments
 (0)