diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd82f2c..ca05997 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,7 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: scalaVersion: ['2.12.20', '2.13.15', '3.3.4', '3.5.2'] javaTag: [ @@ -122,19 +123,17 @@ jobs: SCALA_VERSION=${{ matrix.scalaVersion }} load: true - name: Test docker image as root (default) - if: ${{ !startsWith(matrix.scalaVersion, '2.12') }} + if: ${{ !startsWith(matrix.scalaVersion, '2.12') && !contains(matrix.baseImageTag, 'alpine') }} # scala --version does not work on < 2.13 + # sbt --script-version does not work on alpine https://github.com/sbt/sbt/issues/7942 run: | - docker run "${{ steps.create_docker_tag.outputs.TAG }}" \ - scala --version && - sbt about + docker run "${{ steps.create_docker_tag.outputs.TAG }}" /bin/bash -c "scala --version && sbt --script-version" - name: Test docker image scala as sbtuser - if: ${{ !startsWith(matrix.scalaVersion, '2.12') }} + if: ${{ !startsWith(matrix.scalaVersion, '2.12') && !contains(matrix.baseImageTag, 'alpine') }} # scala --version does not work on < 2.13 + # sbt --script-version does not work on alpine https://github.com/sbt/sbt/issues/7942 run: | - docker run -u sbtuser -w /home/sbtuser "${{ steps.create_docker_tag.outputs.TAG }}" \ - scala --version && - sbt about + docker run -u sbtuser -w /home/sbtuser "${{ steps.create_docker_tag.outputs.TAG }}" /bin/bash -c "scala --version && sbt --script-version" - name: Log in to DockerHub if: github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' uses: docker/login-action@v3 diff --git a/amazoncorretto/Dockerfile b/amazoncorretto/Dockerfile index dee6e19..530aa7a 100644 --- a/amazoncorretto/Dockerfile +++ b/amazoncorretto/Dockerfile @@ -35,18 +35,20 @@ RUN \ # Install Scala RUN \ case $SCALA_VERSION in \ - "3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \ - *) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \ + 2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + 3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + *) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \ esac && \ - curl -fsL --show-error $URL | tar xfz - -C /usr/share && \ + mkdir -p $EXTRACT_DIR && \ + curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \ mv $SCALA_DIR /usr/share/scala && \ chown -R root:root /usr/share/scala && \ chmod -R 755 /usr/share/scala && \ ln -s /usr/share/scala/bin/* /usr/local/bin && \ mkdir -p /test && \ case $SCALA_VERSION in \ - "3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \ - *) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \ + 2*) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \ + *) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \ esac && \ scala -nocompdaemon test/test.scala && \ rm -fr test diff --git a/eclipse-temurin/Dockerfile b/eclipse-temurin/Dockerfile index 5b98f71..614fef8 100644 --- a/eclipse-temurin/Dockerfile +++ b/eclipse-temurin/Dockerfile @@ -36,18 +36,20 @@ RUN \ # Install Scala RUN \ case $SCALA_VERSION in \ - "3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \ - *) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \ + 2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + 3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + *) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \ esac && \ - curl -fsL --show-error $URL | tar xfz - -C /usr/share && \ + mkdir -p $EXTRACT_DIR && \ + curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \ mv $SCALA_DIR /usr/share/scala && \ chown -R root:root /usr/share/scala && \ chmod -R 755 /usr/share/scala && \ ln -s /usr/share/scala/bin/* /usr/local/bin && \ mkdir -p /test && \ case $SCALA_VERSION in \ - "3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \ - *) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \ + 2*) echo "println(util.Properties.versionMsg)" > /test/test.scala ;; \ + *) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > /test/test.scala ;; \ esac && \ scala -nocompdaemon test/test.scala && \ rm -fr test diff --git a/eclipse-temurin/alpine.Dockerfile b/eclipse-temurin/alpine.Dockerfile index a036be3..3d2b1b5 100644 --- a/eclipse-temurin/alpine.Dockerfile +++ b/eclipse-temurin/alpine.Dockerfile @@ -15,17 +15,19 @@ RUN apk add --no-cache --virtual=.build-dependencies wget ca-certificates bash c RUN \ cd "/tmp" && \ case $SCALA_VERSION in \ - "3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=scala3-$SCALA_VERSION ;; \ - *) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=scala-$SCALA_VERSION ;; \ + 2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + 3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + *) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \ esac && \ - curl -fsL --show-error $URL | tar xfz - -C /usr/share && \ - mv /usr/share/$SCALA_DIR $SCALA_HOME && \ + mkdir -p $EXTRACT_DIR && \ + curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \ + mv $SCALA_DIR $SCALA_HOME && \ ln -s "$SCALA_HOME/bin/"* "/usr/bin/" && \ update-ca-certificates && \ scala -version && \ case $SCALA_VERSION in \ - "3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \ - *) echo "println(util.Properties.versionMsg)" > test.scala ;; \ + 2*) echo "println(util.Properties.versionMsg)" > test.scala ;; \ + *) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \ esac && \ scala -nocompdaemon test.scala && rm test.scala diff --git a/graalvm-ce/Dockerfile b/graalvm-ce/Dockerfile index 056b98f..9b0f19b 100644 --- a/graalvm-ce/Dockerfile +++ b/graalvm-ce/Dockerfile @@ -35,20 +35,21 @@ RUN \ ln -s /usr/share/sbt/bin/sbt /usr/local/bin/sbt # Install Scala -## Piping curl directly in tar RUN \ case $SCALA_VERSION in \ - "3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \ - *) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \ + 2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + 3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + *) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \ esac && \ - curl -fsL --show-error $URL | tar xfz - -C /usr/share && \ + mkdir -p $EXTRACT_DIR && \ + curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \ mv $SCALA_DIR /usr/share/scala && \ chown -R root:root /usr/share/scala && \ chmod -R 755 /usr/share/scala && \ ln -s /usr/share/scala/bin/* /usr/local/bin && \ case $SCALA_VERSION in \ - "3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \ - *) echo "println(util.Properties.versionMsg)" > test.scala ;; \ + 2*) echo "println(util.Properties.versionMsg)" > test.scala ;; \ + *) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \ esac && \ scala -nocompdaemon test.scala && rm test.scala diff --git a/graalvm-community/Dockerfile b/graalvm-community/Dockerfile index b8f2b8d..2b52071 100644 --- a/graalvm-community/Dockerfile +++ b/graalvm-community/Dockerfile @@ -35,20 +35,21 @@ RUN \ ln -s /usr/share/sbt/bin/sbt /usr/local/bin/sbt # Install Scala -## Piping curl directly in tar RUN \ case $SCALA_VERSION in \ - "3"*) URL=https://github.com/lampepfl/dotty/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION ;; \ - *) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION ;; \ + 2.*) URL=https://downloads.typesafe.com/scala/$SCALA_VERSION/scala-$SCALA_VERSION.tgz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + 3.[0-5]*) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala3-$SCALA_VERSION EXTRACT_DIR=/usr/share ;; \ + *) URL=https://github.com/scala/scala3/releases/download/$SCALA_VERSION/scala3-$SCALA_VERSION.tar.gz SCALA_DIR=/usr/share/scala-$SCALA_VERSION EXTRACT_DIR=/usr/share/scala-$SCALA_VERSION ;; \ esac && \ - curl -fsL --show-error $URL | tar xfz - -C /usr/share && \ + mkdir -p $EXTRACT_DIR && \ + curl -fsL --show-error $URL | tar xfz - -C $EXTRACT_DIR && \ mv $SCALA_DIR /usr/share/scala && \ chown -R root:root /usr/share/scala && \ chmod -R 755 /usr/share/scala && \ ln -s /usr/share/scala/bin/* /usr/local/bin && \ case $SCALA_VERSION in \ - "3"*) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \ - *) echo "println(util.Properties.versionMsg)" > test.scala ;; \ + 2*) echo "println(util.Properties.versionMsg)" > test.scala ;; \ + *) echo 'import java.io.FileInputStream;import java.util.jar.JarInputStream;val scala3LibJar = classOf[CanEqual[_, _]].getProtectionDomain.getCodeSource.getLocation.toURI.getPath;val manifest = new JarInputStream(new FileInputStream(scala3LibJar)).getManifest;val ver = manifest.getMainAttributes.getValue("Implementation-Version");@main def main = println(s"Scala version ${ver}")' > test.scala ;; \ esac && \ scala -nocompdaemon test.scala && rm test.scala