Skip to content

Commit f61ef22

Browse files
Sync Dockerfiles w/ JDK 22 changes
1 parent 9641615 commit f61ef22

30 files changed

Lines changed: 886 additions & 0 deletions

File tree

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: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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 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 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-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 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

0 commit comments

Comments
 (0)