Skip to content

serandel/kscript-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kscript-docker

Docker Cloud Build Status

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!.

Usage with inline code

docker run -i serandel/kscript 'println("Hello, world!")'

Usage with a script from outside the container

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.

Volume

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.