This repository provides sbt Docker files and images for building Scala projects. The images install sbt (which resolves the project's Scala version itself); a standalone scala CLI is not bundled.
As we think referencing unstable versions is a bad idea we don't publish a latest tag. Our tags consists of three parts: <JDK version>_<sbt version>_<Scala version>.
Images are updated daily
Available JDK base images:
- eclipse-temurin
- graalvm-community
- graalvm-jdk-community (compact GraalVM JDK; smaller, but no
native-image- use graalvm-community if you need it) - amazoncorretto
The images are published at Docker Hub
For a list of all available tags see https://hub.docker.com/r/sbtscala/scala-sbt/tags
Older tags are available at: https://hub.docker.com/r/hseeberger/scala-sbt/tags
- Install Docker
- Pull automated build from public Docker Hub Registry:
docker pull sbtscala/scala-sbt:eclipse-temurin-21.0.8_9_1.12.11_3.8.4
Alternatively, you can build an image from the remote Dockerfile:
docker build \
--build-arg BASE_IMAGE_TAG="21.0.8_9-jdk" \
--build-arg SBT_VERSION="1.12.11" \
--build-arg SCALA_VERSION="3.8.4" \
--build-arg USER_ID=1001 \
--build-arg GROUP_ID=1001 \
-t sbtscala/scala-sbt \
"github.com/sbt/docker-sbt.git#:eclipse-temurin"
docker run -it --rm sbtscala/scala-sbt:eclipse-temurin-21.0.8_9_1.12.11_3.8.4
The container contains bash and sbt.
docker run -it --rm sbtscala/scala-sbt:eclipse-temurin-21.0.8_9_1.12.11_3.8.4 bash
The standalone scala CLI is not bundled: sbt resolves its own Scala per project,
so it was unused for sbt builds. If you want Scala without sbt (scripts, the REPL),
use the Scala CLI image
virtuslab/scala-cli.
The container is prepared to be used with a non-root user called sbtuser
docker run -it --rm -u sbtuser -w /home/sbtuser sbtscala/scala-sbt:eclipse-temurin-21.0.8_9_1.12.11_3.8.4
You can also run as an arbitrary user id. HOME is set to /home/sbtuser, whose
contents are group-writable for the root group (gid 0) that an arbitrary
-u <uid> belongs to by default:
docker run -it --rm -u 1234 -w /home/sbtuser sbtscala/scala-sbt:eclipse-temurin-21.0.8_9_1.12.11_3.8.4
Because the tags combine three independent versions (<JDK>_<sbt>_<Scala>),
Renovate needs a custom versioning to parse
them. The example below pins the image variant (e.g. eclipse-temurin) and the
sbt/Scala versions you already use, and proposes updates whenever the JDK part
(<major>.<minor>.<patch>_<build>) is bumped:
{
"packageRules": [
{
"description": "Parse sbtscala/scala-sbt tags: <JDK>_<sbt>_<Scala>",
"matchDatasources": ["docker"],
"matchPackageNames": ["sbtscala/scala-sbt"],
"versioning": "regex:^(?<compatibility>.*)-(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)_(?<build>\\d+)_\\d+\\.\\d+\\.\\d+_\\d+\\.\\d+\\.\\d+$"
}
]
}The compatibility group keeps Renovate within the same image variant, and the
trailing _\d+\.\d+\.\d+_\d+\.\d+\.\d+ matches (but ignores) the sbt and Scala
parts. Note that JDK bumps in this repo can lag slightly behind upstream JDK
releases.
Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.
This code is open source software licensed under the Apache 2.0 License.