Docker image to run kscript (Kotlin scripting) without needing to install it.
The image is labelled with the same version number as kscript, with the underlying dependencies as updated as possible.
The base image is Ubuntu, with Java, Maven, Kotlin and kscript installed with SDKMAN!.
docker run -i serandel/kscript 'println("Hello, world!")'
docker run -i serandel/kscript - < script.kts
This will make kscript read the code from stdin
while piping the file. Be aware that the -i
flag is needed to have stdout
redirected outside the container. --rm
is just to stop polluting Docker with stopped containers.
It's highly advisable to create a volume for /root/.kscript
so the JARs are cached between different invocations to containers.
docker run -i --rm -v kscript:/root/.kscript serandel/kscript 'println("Hello, world!")'
There is a kscript.sh
Bash shell script that invokes the container with these arguments for your convenience.