Introducing Scalapptainer: drive Linux containers from Scala 3, on any OS. No daemon, no root.
Ever wanted a reproducible Linux toolchain (a specific compiler, simulator, CLI, or even a GUI app) that behaves identically on every machine? Apptainer gives you exactly that: a whole environment as a single, immutable .sif file. The catch is it only runs on Linux and usually means wrestling with shell scripts.
Scalapptainer makes that catch disappear. One dependency, and the same Scala code runs on Linux, Windows (via WSL2), and macOS (via Lima). It detects your host and routes commands to the right backend. On first use it installs Apptainer for you in user mode, bundling the helper tools the installer needs so even a minimal distro just works.
The API is typed and fluent: pull/build hand you back an immutable image handle you configure with bind mounts, env vars, and X11 forwarding, then exec / run / shell. Yes, that includes GUI apps rendered right on your desktop.
Want a taste? No project, no build file, just a .scala file:
//> using dep io.github.dfiantworks::scalapptainer:0.4.0
import scalapptainer.*
@main def cow(): Unit =
Apptainer.pull("docker://ghcr.io/dfiantworks/scalapptainer-cowsay").runInteractive()
scala run cow.scala
A ~30 MB image, an ASCII cow, and a random fortune, running in seconds. ![]()
Check it out on GitHub: GitHub - DFiantWorks/Scalapptainer: Scalapptainer: A cross-platform Scala wrapper around Apptainer · GitHub
Apache-2.0, built with Mill. Give it a try and let me know what you build with it!