From e589525ab00b9756427698d2ea45720df15fedc7 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Mon, 6 Jan 2025 19:39:28 +0000 Subject: [PATCH 1/3] Add Scala-CLI to the ODKFull image. Scala-CLI is the new command-line runner for the Scala language, intended to replace Ammonite. --- CHANGELOG.md | 1 + Dockerfile | 8 ++++++++ Makefile | 1 + 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 165ef558..754b37e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ For more detailed changes see: - J2cli, a command-line tool to process Jinja2 templates, has been replaced by [Jinjanator](https://github.com/kpfleming/jinjanator). If your custom workflows invoke the `j2` tool, you will need to update them to use `jinjanate` instead. - New program `dicer-cli` to manage the ID range file. - Ammonite, the Scala interpreter, is no longer provided in the ODKLite image. If you need Ammonite, you must now use the ODKFull image. +- The Scala-CLI Scala runner has been added to the ODKFull image. ## New configuration options diff --git a/Dockerfile b/Dockerfile index 5cc8cfab..5786812d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ ENV JENA_VERSION=4.9.0 ENV KGCL_JAVA_VERSION=0.5.1 ENV SSSOM_JAVA_VERSION=1.1.1 ENV AMMONITE_VERSION=2.5.9 +ENV SCALA_CLI_VERSION=1.5.4 # Avoid repeated downloads of script dependencies by mounting the local coursier cache: # docker run -v $HOME/.coursier/cache/v1:/tools/.coursier-cache ... @@ -92,6 +93,13 @@ RUN wget -nv https://github.com/lihaoyi/Ammonite/releases/download/$AMMONITE_VER chmod 755 /tools/amm && \ java -cp /tools/amm ammonite.AmmoniteMain /dev/null +# Install Scala-CLI +RUN wget -nv https://github.com/VirtusLab/scala-cli/releases/download/v$SCALA_CLI_VERSION/scala-cli.jar \ + -O /tools/scala-cli.jar && \ + echo "#!/bin/bash" > /tools/scala-cli && \ + echo "java -jar /tools/scala-cli.jar \"\$@\"" >> /tools/scala-cli && \ + chmod 0755 /tools/scala-cli + # Install SPARQLProg. RUN swipl -g "pack_install(sparqlprog, [interactive(false),global(true)])" -g halt diff --git a/Makefile b/Makefile index 015c7ea6..7d5b1f91 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ test_odkfull_programs: test_odklite_programs @./tests/test-program.sh SOUFFLE souffle --version @./tests/test-program.sh JENA jena @./tests/test-program.sh AMMONITE sh amm --help + @./tests/test-program.sh SCALA-CLI scala-cli --version @./tests/test-program.sh SPARQL sparql --version @./tests/test-program.sh SPARQLPROG pl2sparql -g halt @./tests/test-program.sh OBO-DASHBOARD obodash --help From a097d9d1d394c4da400ee34568eb8b59ac0ec6b3 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Mon, 6 Jan 2025 19:33:05 +0000 Subject: [PATCH 2/3] Make sure /tools/.coursier-cache is user-writeable. The ODKFull image defines the COURSIER_CACHE environment variable to /tools/.coursier-cache, so Ammonite and Scala-CLI expect to be able to store their downloaded dependencies in there. If we run under a non-privileged user, we need to ensure that, if the directory does not exist, it is created and given to the odkuser. (If the directory already exists, it means a host directory has been explicitly bound to it, in which case permissions will already be correct, and we have nothing to do.) --- scripts/entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index 0ed80915..13fb3028 100644 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -13,6 +13,10 @@ mkdir -p /home/odkuser chown odkuser:odkuser /home/odkuser [ -d /home/odkuser/.data ] && chown odkuser:odkuser /home/odkuser/.data [ -d /home/odkuser/.data/oaklib ] && chown odkuser:odkuser /home/odkuser/.data/oaklib +if [ ! -d /tools/.coursier-cache ] ; then + mkdir /tools/.coursier-cache + chown odkuser:odkuser /tools/.coursier-cache +fi PATH=$PATH:/home/odkuser/.local/bin [ -S /run/host-services/ssh-auth.sock ] && chown odkuser /run/host-services/ssh-auth.sock From 73563dcb5974f566c045307c6d26583f5f4b9d17 Mon Sep 17 00:00:00 2001 From: Damien Goutte-Gattat Date: Mon, 6 Jan 2025 19:42:48 +0000 Subject: [PATCH 3/3] Remove Ammonite. Now that we have Scala-CLI, there should not be any need for Ammonite anymore. --- CHANGELOG.md | 3 +-- Dockerfile | 7 ------- Makefile | 1 - 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 754b37e3..c5e03802 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,8 +14,7 @@ For more detailed changes see: - New [ROBOT Version 1.9.6](https://github.com/ontodev/robot/releases/tag/v1.9.6). This came with a great number of updates and upgrades, see release notes. - J2cli, a command-line tool to process Jinja2 templates, has been replaced by [Jinjanator](https://github.com/kpfleming/jinjanator). If your custom workflows invoke the `j2` tool, you will need to update them to use `jinjanate` instead. - New program `dicer-cli` to manage the ID range file. -- Ammonite, the Scala interpreter, is no longer provided in the ODKLite image. If you need Ammonite, you must now use the ODKFull image. -- The Scala-CLI Scala runner has been added to the ODKFull image. +- Ammonite, the Scala interpreter, has been replaced by Scala-CLI. The new interpreter is only available in the ODKFull image. ## New configuration options diff --git a/Dockerfile b/Dockerfile index 5786812d..bbe68bb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,6 @@ ENV ODK_VERSION=$ODK_VERSION ENV JENA_VERSION=4.9.0 ENV KGCL_JAVA_VERSION=0.5.1 ENV SSSOM_JAVA_VERSION=1.1.1 -ENV AMMONITE_VERSION=2.5.9 ENV SCALA_CLI_VERSION=1.5.4 # Avoid repeated downloads of script dependencies by mounting the local coursier cache: @@ -87,12 +86,6 @@ RUN test "x$TARGETARCH" = xamd64 && ( \ RUN wget -nv http://archive.apache.org/dist/jena/binaries/apache-jena-$JENA_VERSION.tar.gz -O- | tar xzC /tools && \ mv /tools/apache-jena-$JENA_VERSION /tools/apache-jena -# Install Ammonite -RUN wget -nv https://github.com/lihaoyi/Ammonite/releases/download/$AMMONITE_VERSION/2.13-$AMMONITE_VERSION \ - -O /tools/amm && \ - chmod 755 /tools/amm && \ - java -cp /tools/amm ammonite.AmmoniteMain /dev/null - # Install Scala-CLI RUN wget -nv https://github.com/VirtusLab/scala-cli/releases/download/v$SCALA_CLI_VERSION/scala-cli.jar \ -O /tools/scala-cli.jar && \ diff --git a/Makefile b/Makefile index 7d5b1f91..47ae6384 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,6 @@ test_odkfull_programs: test_odklite_programs @./tests/test-program.sh KONCLUDE Konclude -h @./tests/test-program.sh SOUFFLE souffle --version @./tests/test-program.sh JENA jena - @./tests/test-program.sh AMMONITE sh amm --help @./tests/test-program.sh SCALA-CLI scala-cli --version @./tests/test-program.sh SPARQL sparql --version @./tests/test-program.sh SPARQLPROG pl2sparql -g halt