diff --git a/target/debian-bookworm-11/lein/Dockerfile b/target/debian-bookworm-11/lein/Dockerfile index 85b41a59..8b759496 100644 --- a/target/debian-bookworm-11/lein/Dockerfile +++ b/target/debian-bookworm-11/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bookworm-21/latest/rlwrap.retry b/target/debian-bookworm-11/lein/rlwrap.retry similarity index 100% rename from target/debian-bookworm-21/latest/rlwrap.retry rename to target/debian-bookworm-11/lein/rlwrap.retry diff --git a/target/debian-bookworm-11/tools-deps/Dockerfile b/target/debian-bookworm-11/tools-deps/Dockerfile index e71c4344..b7778269 100644 --- a/target/debian-bookworm-11/tools-deps/Dockerfile +++ b/target/debian-bookworm-11/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-17/lein/Dockerfile b/target/debian-bookworm-17/lein/Dockerfile index a1ebdab5..8e122034 100644 --- a/target/debian-bookworm-17/lein/Dockerfile +++ b/target/debian-bookworm-17/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bookworm-17/lein/rlwrap.retry b/target/debian-bookworm-17/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-17/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-17/tools-deps/Dockerfile b/target/debian-bookworm-17/tools-deps/Dockerfile index 9d44578d..4a115f16 100644 --- a/target/debian-bookworm-17/tools-deps/Dockerfile +++ b/target/debian-bookworm-17/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-21/latest/Dockerfile b/target/debian-bookworm-21/latest/Dockerfile deleted file mode 100644 index d064f973..00000000 --- a/target/debian-bookworm-21/latest/Dockerfile +++ /dev/null @@ -1,73 +0,0 @@ -FROM debian:bookworm - -ENV JAVA_HOME=/opt/java/openjdk -COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME -ENV PATH="${JAVA_HOME}/bin:${PATH}" - - -### INSTALL LEIN ### -ENV LEIN_VERSION=2.11.2 -ENV LEIN_INSTALL=/usr/local/bin/ - -WORKDIR /tmp - -# Download the whole repo as an archive -RUN set -eux; \ -apt-get update && \ -apt-get install -y make gnupg wget && \ -rm -rf /var/lib/apt/lists/* && \ -mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ -echo "Comparing lein-pkg checksum ..." && \ -sha256sum lein-pkg && \ -echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ -mv lein-pkg $LEIN_INSTALL/lein && \ -chmod 0755 $LEIN_INSTALL/lein && \ -export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ -gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj - -### INSTALL TOOLS-DEPS ### -ENV CLOJURE_VERSION=1.11.1.1435 - -WORKDIR /tmp - -RUN \ -apt-get update && \ -apt-get install -y curl make git rlwrap && \ -rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl - -# Docker bug makes rlwrap crash w/o short sleep first -# Bug: https://github.com/moby/moby/issues/28009 -# As of 2021-09-10 this bug still exists, despite that issue being closed -COPY rlwrap.retry /usr/local/bin/rlwrap - -COPY entrypoint /usr/local/bin/entrypoint - -ENTRYPOINT ["entrypoint"] - -CMD ["-M", "--repl"] diff --git a/target/debian-bookworm-21/latest/entrypoint b/target/debian-bookworm-21/latest/entrypoint deleted file mode 100755 index 51561d1d..00000000 --- a/target/debian-bookworm-21/latest/entrypoint +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -eou pipefail - -entrypoint=clj - -cmd=${1:-} - -# check if the first arg starts with a hyphen -if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then - exec "${entrypoint}" "$@" -fi - -if [[ -n "${cmd}" ]]; then - # see if help for the subcommand is successful - if "${entrypoint}" "${cmd}" --help >/dev/null 2>&1; then - exec "${entrypoint}" "$@" - fi -fi - -exec "$@" diff --git a/target/debian-bookworm-21/lein/Dockerfile b/target/debian-bookworm-21/lein/Dockerfile index 9a1e5071..417a10de 100644 --- a/target/debian-bookworm-21/lein/Dockerfile +++ b/target/debian-bookworm-21/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bookworm-21/lein/rlwrap.retry b/target/debian-bookworm-21/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-21/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-21/tools-deps/Dockerfile b/target/debian-bookworm-21/tools-deps/Dockerfile index 90220295..e0c6572c 100644 --- a/target/debian-bookworm-21/tools-deps/Dockerfile +++ b/target/debian-bookworm-21/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-22/lein/Dockerfile b/target/debian-bookworm-22/lein/Dockerfile index 954795b9..e4e5d175 100644 --- a/target/debian-bookworm-22/lein/Dockerfile +++ b/target/debian-bookworm-22/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bookworm-22/lein/rlwrap.retry b/target/debian-bookworm-22/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-22/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-22/tools-deps/Dockerfile b/target/debian-bookworm-22/tools-deps/Dockerfile index b6f506f2..ca889ebb 100644 --- a/target/debian-bookworm-22/tools-deps/Dockerfile +++ b/target/debian-bookworm-22/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-8/lein/Dockerfile b/target/debian-bookworm-8/lein/Dockerfile index da37f93b..d6ef647c 100644 --- a/target/debian-bookworm-8/lein/Dockerfile +++ b/target/debian-bookworm-8/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bookworm-8/lein/rlwrap.retry b/target/debian-bookworm-8/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-8/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-8/tools-deps/Dockerfile b/target/debian-bookworm-8/tools-deps/Dockerfile index 777ee3b7..63181fa0 100644 --- a/target/debian-bookworm-8/tools-deps/Dockerfile +++ b/target/debian-bookworm-8/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:8 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-slim-11/lein/Dockerfile b/target/debian-bookworm-slim-11/lein/Dockerfile index 82cb00a9..f0afd713 100644 --- a/target/debian-bookworm-slim-11/lein/Dockerfile +++ b/target/debian-bookworm-slim-11/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bookworm-slim-11/lein/rlwrap.retry b/target/debian-bookworm-slim-11/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-slim-11/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-slim-11/tools-deps/Dockerfile b/target/debian-bookworm-slim-11/tools-deps/Dockerfile index 5f8c741d..2d3a8d22 100644 --- a/target/debian-bookworm-slim-11/tools-deps/Dockerfile +++ b/target/debian-bookworm-slim-11/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-slim-17/lein/Dockerfile b/target/debian-bookworm-slim-17/lein/Dockerfile index 99fd72c5..3d79f9e2 100644 --- a/target/debian-bookworm-slim-17/lein/Dockerfile +++ b/target/debian-bookworm-slim-17/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bookworm-slim-17/lein/rlwrap.retry b/target/debian-bookworm-slim-17/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-slim-17/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-slim-17/tools-deps/Dockerfile b/target/debian-bookworm-slim-17/tools-deps/Dockerfile index 4aad2597..a9e3a64b 100644 --- a/target/debian-bookworm-slim-17/tools-deps/Dockerfile +++ b/target/debian-bookworm-slim-17/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-slim-21/lein/Dockerfile b/target/debian-bookworm-slim-21/lein/Dockerfile index 1b8d9820..2fd1a1e6 100644 --- a/target/debian-bookworm-slim-21/lein/Dockerfile +++ b/target/debian-bookworm-slim-21/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bookworm-slim-21/lein/rlwrap.retry b/target/debian-bookworm-slim-21/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-slim-21/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-slim-21/tools-deps/Dockerfile b/target/debian-bookworm-slim-21/tools-deps/Dockerfile index d88192a6..2ee0ec0a 100644 --- a/target/debian-bookworm-slim-21/tools-deps/Dockerfile +++ b/target/debian-bookworm-slim-21/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-slim-22/lein/Dockerfile b/target/debian-bookworm-slim-22/lein/Dockerfile index 054c0dfc..f60c74dd 100644 --- a/target/debian-bookworm-slim-22/lein/Dockerfile +++ b/target/debian-bookworm-slim-22/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bookworm-slim-22/lein/rlwrap.retry b/target/debian-bookworm-slim-22/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-slim-22/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-slim-22/tools-deps/Dockerfile b/target/debian-bookworm-slim-22/tools-deps/Dockerfile index 9ad2cd59..0ac32592 100644 --- a/target/debian-bookworm-slim-22/tools-deps/Dockerfile +++ b/target/debian-bookworm-slim-22/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bookworm-slim-8/lein/Dockerfile b/target/debian-bookworm-slim-8/lein/Dockerfile index 1d5f9697..6e3c619f 100644 --- a/target/debian-bookworm-slim-8/lein/Dockerfile +++ b/target/debian-bookworm-slim-8/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bookworm-slim-8/lein/rlwrap.retry b/target/debian-bookworm-slim-8/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bookworm-slim-8/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bookworm-slim-8/tools-deps/Dockerfile b/target/debian-bookworm-slim-8/tools-deps/Dockerfile index 12164e98..bd843a34 100644 --- a/target/debian-bookworm-slim-8/tools-deps/Dockerfile +++ b/target/debian-bookworm-slim-8/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:8 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-11/lein/Dockerfile b/target/debian-bullseye-11/lein/Dockerfile index 6e7ad388..89198e13 100644 --- a/target/debian-bullseye-11/lein/Dockerfile +++ b/target/debian-bullseye-11/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bullseye-11/lein/rlwrap.retry b/target/debian-bullseye-11/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-11/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-11/tools-deps/Dockerfile b/target/debian-bullseye-11/tools-deps/Dockerfile index 6b5a1e1e..e0518306 100644 --- a/target/debian-bullseye-11/tools-deps/Dockerfile +++ b/target/debian-bullseye-11/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-17/lein/Dockerfile b/target/debian-bullseye-17/lein/Dockerfile index 5b51e29f..99dc5678 100644 --- a/target/debian-bullseye-17/lein/Dockerfile +++ b/target/debian-bullseye-17/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bullseye-17/lein/rlwrap.retry b/target/debian-bullseye-17/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-17/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-17/tools-deps/Dockerfile b/target/debian-bullseye-17/tools-deps/Dockerfile index 176b2792..88f76a12 100644 --- a/target/debian-bullseye-17/tools-deps/Dockerfile +++ b/target/debian-bullseye-17/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-21/lein/Dockerfile b/target/debian-bullseye-21/lein/Dockerfile index aa335e9e..3e1b3bef 100644 --- a/target/debian-bullseye-21/lein/Dockerfile +++ b/target/debian-bullseye-21/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bullseye-21/lein/rlwrap.retry b/target/debian-bullseye-21/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-21/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-21/tools-deps/Dockerfile b/target/debian-bullseye-21/tools-deps/Dockerfile index 9326e92d..148159fa 100644 --- a/target/debian-bullseye-21/tools-deps/Dockerfile +++ b/target/debian-bullseye-21/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-22/lein/Dockerfile b/target/debian-bullseye-22/lein/Dockerfile index 46ebc8f5..d1ebede4 100644 --- a/target/debian-bullseye-22/lein/Dockerfile +++ b/target/debian-bullseye-22/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bullseye-22/lein/rlwrap.retry b/target/debian-bullseye-22/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-22/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-22/tools-deps/Dockerfile b/target/debian-bullseye-22/tools-deps/Dockerfile index 97fcd812..e21cce3d 100644 --- a/target/debian-bullseye-22/tools-deps/Dockerfile +++ b/target/debian-bullseye-22/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-8/lein/Dockerfile b/target/debian-bullseye-8/lein/Dockerfile index 72e9a4a2..adccfa89 100644 --- a/target/debian-bullseye-8/lein/Dockerfile +++ b/target/debian-bullseye-8/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bullseye-8/lein/rlwrap.retry b/target/debian-bullseye-8/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-8/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-8/tools-deps/Dockerfile b/target/debian-bullseye-8/tools-deps/Dockerfile index 4daee8f9..f070d90c 100644 --- a/target/debian-bullseye-8/tools-deps/Dockerfile +++ b/target/debian-bullseye-8/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:8 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-slim-11/lein/Dockerfile b/target/debian-bullseye-slim-11/lein/Dockerfile index aa27e2f9..e9c86de8 100644 --- a/target/debian-bullseye-slim-11/lein/Dockerfile +++ b/target/debian-bullseye-slim-11/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bullseye-slim-11/lein/rlwrap.retry b/target/debian-bullseye-slim-11/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-slim-11/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-slim-11/tools-deps/Dockerfile b/target/debian-bullseye-slim-11/tools-deps/Dockerfile index 50d94454..e15543a4 100644 --- a/target/debian-bullseye-slim-11/tools-deps/Dockerfile +++ b/target/debian-bullseye-slim-11/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:11 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-slim-17/lein/Dockerfile b/target/debian-bullseye-slim-17/lein/Dockerfile index ef84cab4..01e722c4 100644 --- a/target/debian-bullseye-slim-17/lein/Dockerfile +++ b/target/debian-bullseye-slim-17/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bullseye-slim-17/lein/rlwrap.retry b/target/debian-bullseye-slim-17/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-slim-17/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-slim-17/tools-deps/Dockerfile b/target/debian-bullseye-slim-17/tools-deps/Dockerfile index 28dac307..6c2c2754 100644 --- a/target/debian-bullseye-slim-17/tools-deps/Dockerfile +++ b/target/debian-bullseye-slim-17/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-slim-21/lein/Dockerfile b/target/debian-bullseye-slim-21/lein/Dockerfile index 37c0e8ff..40d53748 100644 --- a/target/debian-bullseye-slim-21/lein/Dockerfile +++ b/target/debian-bullseye-slim-21/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bullseye-slim-21/lein/rlwrap.retry b/target/debian-bullseye-slim-21/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-slim-21/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-slim-21/tools-deps/Dockerfile b/target/debian-bullseye-slim-21/tools-deps/Dockerfile index 4412f8c1..0a5c47a5 100644 --- a/target/debian-bullseye-slim-21/tools-deps/Dockerfile +++ b/target/debian-bullseye-slim-21/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:21 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-slim-22/lein/Dockerfile b/target/debian-bullseye-slim-22/lein/Dockerfile index 86016b83..d2e1fb6a 100644 --- a/target/debian-bullseye-slim-22/lein/Dockerfile +++ b/target/debian-bullseye-slim-22/lein/Dockerfile @@ -6,40 +6,49 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 - -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg + +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/debian-bullseye-slim-22/lein/rlwrap.retry b/target/debian-bullseye-slim-22/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-slim-22/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-slim-22/tools-deps/Dockerfile b/target/debian-bullseye-slim-22/tools-deps/Dockerfile index 895f0d20..94f3ade3 100644 --- a/target/debian-bullseye-slim-22/tools-deps/Dockerfile +++ b/target/debian-bullseye-slim-22/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:22 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/debian-bullseye-slim-8/lein/Dockerfile b/target/debian-bullseye-slim-8/lein/Dockerfile index 15ed6841..a5993e00 100644 --- a/target/debian-bullseye-slim-8/lein/Dockerfile +++ b/target/debian-bullseye-slim-8/lein/Dockerfile @@ -6,39 +6,48 @@ ENV PATH="${JAVA_HOME}/bin:${PATH}" ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove curl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/debian-bullseye-slim-8/lein/rlwrap.retry b/target/debian-bullseye-slim-8/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/debian-bullseye-slim-8/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/debian-bullseye-slim-8/tools-deps/Dockerfile b/target/debian-bullseye-slim-8/tools-deps/Dockerfile index fecf3639..6fb481a9 100644 --- a/target/debian-bullseye-slim-8/tools-deps/Dockerfile +++ b/target/debian-bullseye-slim-8/tools-deps/Dockerfile @@ -4,22 +4,46 @@ ENV JAVA_HOME=/opt/java/openjdk COPY --from=eclipse-temurin:8 $JAVA_HOME $JAVA_HOME ENV PATH="${JAVA_HOME}/bin:${PATH}" -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apt-get purge -y --auto-remove curl +apt-get purge -y --auto-remove curl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-11-jdk-alpine/lein/Dockerfile b/target/eclipse-temurin-11-jdk-alpine/lein/Dockerfile index 11863bdc..b739bb67 100644 --- a/target/eclipse-temurin-11-jdk-alpine/lein/Dockerfile +++ b/target/eclipse-temurin-11-jdk-alpine/lein/Dockerfile @@ -2,37 +2,46 @@ FROM eclipse-temurin:11-jdk-alpine ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ -apk add --no-cache ca-certificates bash tar openssl gnupg && \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apk del ca-certificates tar openssl gnupg - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apk del ca-certificates curl tar openssl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/eclipse-temurin-11-jdk-alpine/lein/rlwrap.retry b/target/eclipse-temurin-11-jdk-alpine/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-11-jdk-alpine/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-11-jdk-alpine/tools-deps/Dockerfile b/target/eclipse-temurin-11-jdk-alpine/tools-deps/Dockerfile index aaefb7b5..dc87ec5f 100644 --- a/target/eclipse-temurin-11-jdk-alpine/tools-deps/Dockerfile +++ b/target/eclipse-temurin-11-jdk-alpine/tools-deps/Dockerfile @@ -1,19 +1,43 @@ FROM eclipse-temurin:11-jdk-alpine -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ -apk add --no-cache curl bash make git && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +RUN set -eux; \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apk del curl +apk del ca-certificates curl tar openssl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-11-jdk-focal/lein/Dockerfile b/target/eclipse-temurin-11-jdk-focal/lein/Dockerfile index e20f07cc..b7b8303a 100644 --- a/target/eclipse-temurin-11-jdk-focal/lein/Dockerfile +++ b/target/eclipse-temurin-11-jdk-focal/lein/Dockerfile @@ -2,39 +2,48 @@ FROM eclipse-temurin:11-jdk-focal ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/eclipse-temurin-11-jdk-focal/lein/rlwrap.retry b/target/eclipse-temurin-11-jdk-focal/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-11-jdk-focal/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-11-jdk-focal/tools-deps/Dockerfile b/target/eclipse-temurin-11-jdk-focal/tools-deps/Dockerfile index df5ac2ba..96004d52 100644 --- a/target/eclipse-temurin-11-jdk-focal/tools-deps/Dockerfile +++ b/target/eclipse-temurin-11-jdk-focal/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:11-jdk-focal -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-11-jdk-jammy/lein/Dockerfile b/target/eclipse-temurin-11-jdk-jammy/lein/Dockerfile index 6d08b35b..36cc591d 100644 --- a/target/eclipse-temurin-11-jdk-jammy/lein/Dockerfile +++ b/target/eclipse-temurin-11-jdk-jammy/lein/Dockerfile @@ -2,39 +2,48 @@ FROM eclipse-temurin:11-jdk-jammy ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/eclipse-temurin-11-jdk-jammy/lein/rlwrap.retry b/target/eclipse-temurin-11-jdk-jammy/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-11-jdk-jammy/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-11-jdk-jammy/tools-deps/Dockerfile b/target/eclipse-temurin-11-jdk-jammy/tools-deps/Dockerfile index 9b53c7d0..9922e197 100644 --- a/target/eclipse-temurin-11-jdk-jammy/tools-deps/Dockerfile +++ b/target/eclipse-temurin-11-jdk-jammy/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:11-jdk-jammy -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-17-jdk-alpine/lein/Dockerfile b/target/eclipse-temurin-17-jdk-alpine/lein/Dockerfile index 1683de42..53dceb8c 100644 --- a/target/eclipse-temurin-17-jdk-alpine/lein/Dockerfile +++ b/target/eclipse-temurin-17-jdk-alpine/lein/Dockerfile @@ -2,38 +2,47 @@ FROM eclipse-temurin:17-jdk-alpine ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ -apk add --no-cache ca-certificates bash tar openssl gnupg && \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apk del ca-certificates tar openssl gnupg - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apk del ca-certificates curl tar openssl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/eclipse-temurin-17-jdk-alpine/lein/rlwrap.retry b/target/eclipse-temurin-17-jdk-alpine/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-17-jdk-alpine/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-17-jdk-alpine/tools-deps/Dockerfile b/target/eclipse-temurin-17-jdk-alpine/tools-deps/Dockerfile index fc758f39..7f70e86d 100644 --- a/target/eclipse-temurin-17-jdk-alpine/tools-deps/Dockerfile +++ b/target/eclipse-temurin-17-jdk-alpine/tools-deps/Dockerfile @@ -1,19 +1,43 @@ FROM eclipse-temurin:17-jdk-alpine -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ -apk add --no-cache curl bash make git && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +RUN set -eux; \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apk del curl +apk del ca-certificates curl tar openssl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-17-jdk-focal/lein/Dockerfile b/target/eclipse-temurin-17-jdk-focal/lein/Dockerfile index abf29e08..81e990eb 100644 --- a/target/eclipse-temurin-17-jdk-focal/lein/Dockerfile +++ b/target/eclipse-temurin-17-jdk-focal/lein/Dockerfile @@ -2,40 +2,49 @@ FROM eclipse-temurin:17-jdk-focal ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/eclipse-temurin-17-jdk-focal/lein/rlwrap.retry b/target/eclipse-temurin-17-jdk-focal/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-17-jdk-focal/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-17-jdk-focal/tools-deps/Dockerfile b/target/eclipse-temurin-17-jdk-focal/tools-deps/Dockerfile index 56e5e6b9..4067e3ba 100644 --- a/target/eclipse-temurin-17-jdk-focal/tools-deps/Dockerfile +++ b/target/eclipse-temurin-17-jdk-focal/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:17-jdk-focal -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-17-jdk-jammy/lein/Dockerfile b/target/eclipse-temurin-17-jdk-jammy/lein/Dockerfile index 03f2de6d..fba63851 100644 --- a/target/eclipse-temurin-17-jdk-jammy/lein/Dockerfile +++ b/target/eclipse-temurin-17-jdk-jammy/lein/Dockerfile @@ -2,40 +2,49 @@ FROM eclipse-temurin:17-jdk-jammy ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/eclipse-temurin-17-jdk-jammy/lein/rlwrap.retry b/target/eclipse-temurin-17-jdk-jammy/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-17-jdk-jammy/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-17-jdk-jammy/tools-deps/Dockerfile b/target/eclipse-temurin-17-jdk-jammy/tools-deps/Dockerfile index 9e6ba548..331fe8a0 100644 --- a/target/eclipse-temurin-17-jdk-jammy/tools-deps/Dockerfile +++ b/target/eclipse-temurin-17-jdk-jammy/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:17-jdk-jammy -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-21-jdk-alpine/lein/Dockerfile b/target/eclipse-temurin-21-jdk-alpine/lein/Dockerfile index 3f5774a6..9a174d85 100644 --- a/target/eclipse-temurin-21-jdk-alpine/lein/Dockerfile +++ b/target/eclipse-temurin-21-jdk-alpine/lein/Dockerfile @@ -2,38 +2,47 @@ FROM eclipse-temurin:21-jdk-alpine ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ -apk add --no-cache ca-certificates bash tar openssl gnupg && \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apk del ca-certificates tar openssl gnupg - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apk del ca-certificates curl tar openssl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/eclipse-temurin-21-jdk-alpine/lein/rlwrap.retry b/target/eclipse-temurin-21-jdk-alpine/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-21-jdk-alpine/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-21-jdk-alpine/tools-deps/Dockerfile b/target/eclipse-temurin-21-jdk-alpine/tools-deps/Dockerfile index 83e31e50..c91df61b 100644 --- a/target/eclipse-temurin-21-jdk-alpine/tools-deps/Dockerfile +++ b/target/eclipse-temurin-21-jdk-alpine/tools-deps/Dockerfile @@ -1,19 +1,43 @@ FROM eclipse-temurin:21-jdk-alpine -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ -apk add --no-cache curl bash make git && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +RUN set -eux; \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apk del curl +apk del ca-certificates curl tar openssl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-21-jdk-jammy/lein/Dockerfile b/target/eclipse-temurin-21-jdk-jammy/lein/Dockerfile index 434fb8a4..037bfe12 100644 --- a/target/eclipse-temurin-21-jdk-jammy/lein/Dockerfile +++ b/target/eclipse-temurin-21-jdk-jammy/lein/Dockerfile @@ -2,40 +2,49 @@ FROM eclipse-temurin:21-jdk-jammy ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/eclipse-temurin-21-jdk-jammy/lein/rlwrap.retry b/target/eclipse-temurin-21-jdk-jammy/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-21-jdk-jammy/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-21-jdk-jammy/tools-deps/Dockerfile b/target/eclipse-temurin-21-jdk-jammy/tools-deps/Dockerfile index 0f975af9..5510c266 100644 --- a/target/eclipse-temurin-21-jdk-jammy/tools-deps/Dockerfile +++ b/target/eclipse-temurin-21-jdk-jammy/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:21-jdk-jammy -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-22-jdk-alpine/lein/Dockerfile b/target/eclipse-temurin-22-jdk-alpine/lein/Dockerfile index 3af1f17e..f1a92497 100644 --- a/target/eclipse-temurin-22-jdk-alpine/lein/Dockerfile +++ b/target/eclipse-temurin-22-jdk-alpine/lein/Dockerfile @@ -2,38 +2,47 @@ FROM eclipse-temurin:22-jdk-alpine ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ -apk add --no-cache ca-certificates bash tar openssl gnupg && \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apk del ca-certificates tar openssl gnupg - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apk del ca-certificates curl tar openssl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/eclipse-temurin-22-jdk-alpine/lein/rlwrap.retry b/target/eclipse-temurin-22-jdk-alpine/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-22-jdk-alpine/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-22-jdk-alpine/tools-deps/Dockerfile b/target/eclipse-temurin-22-jdk-alpine/tools-deps/Dockerfile index 35a947cc..0abf3703 100644 --- a/target/eclipse-temurin-22-jdk-alpine/tools-deps/Dockerfile +++ b/target/eclipse-temurin-22-jdk-alpine/tools-deps/Dockerfile @@ -1,19 +1,43 @@ FROM eclipse-temurin:22-jdk-alpine -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ -apk add --no-cache curl bash make git && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +RUN set -eux; \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apk del curl +apk del ca-certificates curl tar openssl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-22-jdk-jammy/lein/Dockerfile b/target/eclipse-temurin-22-jdk-jammy/lein/Dockerfile index 63a02944..0dff9ddf 100644 --- a/target/eclipse-temurin-22-jdk-jammy/lein/Dockerfile +++ b/target/eclipse-temurin-22-jdk-jammy/lein/Dockerfile @@ -2,40 +2,49 @@ FROM eclipse-temurin:22-jdk-jammy ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap COPY entrypoint /usr/local/bin/entrypoint diff --git a/target/eclipse-temurin-22-jdk-jammy/lein/rlwrap.retry b/target/eclipse-temurin-22-jdk-jammy/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-22-jdk-jammy/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-22-jdk-jammy/tools-deps/Dockerfile b/target/eclipse-temurin-22-jdk-jammy/tools-deps/Dockerfile index ae6a1e1e..b7ba50f5 100644 --- a/target/eclipse-temurin-22-jdk-jammy/tools-deps/Dockerfile +++ b/target/eclipse-temurin-22-jdk-jammy/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:22-jdk-jammy -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-8-jdk-alpine/lein/Dockerfile b/target/eclipse-temurin-8-jdk-alpine/lein/Dockerfile index 40a51d4e..903e70cc 100644 --- a/target/eclipse-temurin-8-jdk-alpine/lein/Dockerfile +++ b/target/eclipse-temurin-8-jdk-alpine/lein/Dockerfile @@ -2,37 +2,46 @@ FROM eclipse-temurin:8-jdk-alpine ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ -apk add --no-cache ca-certificates bash tar openssl gnupg && \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apk del ca-certificates tar openssl gnupg - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apk del ca-certificates curl tar openssl gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/eclipse-temurin-8-jdk-alpine/lein/rlwrap.retry b/target/eclipse-temurin-8-jdk-alpine/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-8-jdk-alpine/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-8-jdk-alpine/tools-deps/Dockerfile b/target/eclipse-temurin-8-jdk-alpine/tools-deps/Dockerfile index 2bc521eb..0962cc60 100644 --- a/target/eclipse-temurin-8-jdk-alpine/tools-deps/Dockerfile +++ b/target/eclipse-temurin-8-jdk-alpine/tools-deps/Dockerfile @@ -1,19 +1,43 @@ FROM eclipse-temurin:8-jdk-alpine -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ -apk add --no-cache curl bash make git && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ +RUN set -eux; \ +apk add --no-cache ca-certificates curl bash tar openssl make git gnupg && \ +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ clojure -e "(clojure-version)" && \ -apk del curl +apk del ca-certificates curl tar openssl gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-8-jdk-focal/lein/Dockerfile b/target/eclipse-temurin-8-jdk-focal/lein/Dockerfile index b1065f94..364b5b41 100644 --- a/target/eclipse-temurin-8-jdk-focal/lein/Dockerfile +++ b/target/eclipse-temurin-8-jdk-focal/lein/Dockerfile @@ -2,39 +2,48 @@ FROM eclipse-temurin:8-jdk-focal ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/eclipse-temurin-8-jdk-focal/lein/rlwrap.retry b/target/eclipse-temurin-8-jdk-focal/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-8-jdk-focal/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-8-jdk-focal/tools-deps/Dockerfile b/target/eclipse-temurin-8-jdk-focal/tools-deps/Dockerfile index e87147bf..c7a5d974 100644 --- a/target/eclipse-temurin-8-jdk-focal/tools-deps/Dockerfile +++ b/target/eclipse-temurin-8-jdk-focal/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:8-jdk-focal -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009 diff --git a/target/eclipse-temurin-8-jdk-jammy/lein/Dockerfile b/target/eclipse-temurin-8-jdk-jammy/lein/Dockerfile index 3027a5c5..52645486 100644 --- a/target/eclipse-temurin-8-jdk-jammy/lein/Dockerfile +++ b/target/eclipse-temurin-8-jdk-jammy/lein/Dockerfile @@ -2,39 +2,48 @@ FROM eclipse-temurin:8-jdk-jammy ENV LEIN_VERSION=2.11.2 ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -# Download the whole repo as an archive RUN set -eux; \ apt-get update && \ -apt-get install -y make gnupg wget && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ +echo Installing Leiningen && \ mkdir -p $LEIN_INSTALL && \ -wget -q https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ echo "Comparing lein-pkg checksum ..." && \ sha256sum lein-pkg && \ echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ mv lein-pkg $LEIN_INSTALL/lein && \ chmod 0755 $LEIN_INSTALL/lein && \ export GNUPGHOME="$(mktemp -d)" && \ -export FILENAME_EXT=jar && \ gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ -wget -q https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ -echo "Verifying file PGP signature..." && \ -gpg --batch --verify leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ gpgconf --kill all && \ -rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT.asc && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ mkdir -p /usr/share/java && \ -mv leiningen-$LEIN_VERSION-standalone.$FILENAME_EXT /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ -apt-get purge -y --auto-remove gnupg wget - -ENV PATH=$PATH:$LEIN_INSTALL -ENV LEIN_ROOT 1 +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg -# Install clojure 1.11.1 so users don't have to download it every time -RUN echo '(defproject dummy "" :dependencies [[org.clojure/clojure "1.11.1"]])' > project.clj \ - && lein deps && rm project.clj +# Docker bug makes rlwrap crash w/o short sleep first +# Bug: https://github.com/moby/moby/issues/28009 +# As of 2021-09-10 this bug still exists, despite that issue being closed +COPY rlwrap.retry /usr/local/bin/rlwrap CMD ["lein", "repl"] diff --git a/target/eclipse-temurin-8-jdk-jammy/lein/rlwrap.retry b/target/eclipse-temurin-8-jdk-jammy/lein/rlwrap.retry new file mode 100755 index 00000000..83cefbfb --- /dev/null +++ b/target/eclipse-temurin-8-jdk-jammy/lein/rlwrap.retry @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script works around a Docker bug that prevents rlwrap from starting +# right when a container is first started. It is intended to replace +# /usr/bin/rlwrap and also be named rlwrap but earlier in the PATH +# (e.g. /usr/local/bin). + +max_tries=100 # 100 tries is ~1 second +try=0 + +while true; do + # see if rlwrap can start at all + output=$(/usr/bin/rlwrap true 2>&1 >/dev/null) + exit_code=$? + if [ $exit_code -gt 0 ]; then + # it didn't start + try=$((try+1)) + if [ $try -gt $max_tries ]; then + # we're at max attempts so output the error and exit w/ the same code + echo "$output" >&2 + exit $exit_code + else + # wait a bit and try again + sleep 0.01 + fi + else + # rlwrap can start so let's run it for real + exec /usr/bin/rlwrap "$@" + fi +done diff --git a/target/eclipse-temurin-8-jdk-jammy/tools-deps/Dockerfile b/target/eclipse-temurin-8-jdk-jammy/tools-deps/Dockerfile index 57434f3d..384186b9 100644 --- a/target/eclipse-temurin-8-jdk-jammy/tools-deps/Dockerfile +++ b/target/eclipse-temurin-8-jdk-jammy/tools-deps/Dockerfile @@ -1,20 +1,45 @@ FROM eclipse-temurin:8-jdk-jammy -ENV CLOJURE_VERSION=1.11.1.1435 +ENV LEIN_VERSION=2.11.2 +ENV LEIN_INSTALL=/usr/local/bin/ +ENV LEIN_ROOT=1 +ENV PATH=$PATH:$LEIN_INSTALL +ENV CLOJURE_CLI_VERSION=1.11.1.1435 WORKDIR /tmp -RUN \ +RUN set -eux; \ apt-get update && \ -apt-get install -y curl make git rlwrap && \ +apt-get install -y curl make git rlwrap gnupg && \ rm -rf /var/lib/apt/lists/* && \ -curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_VERSION.sh && \ -sha256sum linux-install-$CLOJURE_VERSION.sh && \ -echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_VERSION.sh" | sha256sum -c - && \ -chmod +x linux-install-$CLOJURE_VERSION.sh && \ -./linux-install-$CLOJURE_VERSION.sh && \ -rm linux-install-$CLOJURE_VERSION.sh && \ -clojure -e "(clojure-version)" +echo Installing Leiningen && \ +mkdir -p $LEIN_INSTALL && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/raw/tag/$LEIN_VERSION/bin/lein-pkg && \ +echo "Comparing lein-pkg checksum ..." && \ +sha256sum lein-pkg && \ +echo "28a1a62668c5f427b413a8677e376affaa995f023b1fcd06e2d4c98ac1df5f3e *lein-pkg" | sha256sum -c - && \ +mv lein-pkg $LEIN_INSTALL/lein && \ +chmod 0755 $LEIN_INSTALL/lein && \ +export GNUPGHOME="$(mktemp -d)" && \ +gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys 9D13D9426A0814B3373CF5E3D8A8243577A7859F && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar && \ +curl -fsSLO https://codeberg.org/leiningen/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar.asc && \ +echo "Verifying Leiningen file PGP signature..." && \ +gpg --batch --verify leiningen-$LEIN_VERSION-standalone.jar.asc leiningen-$LEIN_VERSION-standalone.jar && \ +gpgconf --kill all && \ +rm -rf "$GNUPGHOME" leiningen-$LEIN_VERSION-standalone.jar.asc && \ +mkdir -p /usr/share/java && \ +mv leiningen-$LEIN_VERSION-standalone.jar /usr/share/java/leiningen-$LEIN_VERSION-standalone.jar && \ +mkdir -p ~/.lein/ && \ +echo Installing tools.deps && \ +curl -fsSLO https://download.clojure.org/install/linux-install-$CLOJURE_CLI_VERSION.sh && \ +sha256sum linux-install-$CLOJURE_CLI_VERSION.sh && \ +echo "7edee5b12197a2dbe6338e672b109b18164cde84bea1f049ceceed41fc4dd10a *linux-install-$CLOJURE_CLI_VERSION.sh" | sha256sum -c - && \ +chmod +x linux-install-$CLOJURE_CLI_VERSION.sh && \ +./linux-install-$CLOJURE_CLI_VERSION.sh && \ +rm linux-install-$CLOJURE_CLI_VERSION.sh && \ +clojure -e "(clojure-version)" && \ +apt-get purge -y --auto-remove gnupg # Docker bug makes rlwrap crash w/o short sleep first # Bug: https://github.com/moby/moby/issues/28009