Dockerized SBT for building Scala and Java projects
docker run -v <path to your scala project on host machine>:/scala-project alekslitvinenk/sbt
Optionally, you can bind-mount output directory if you want the artifact to be saved on directory other than /target
-v <path where you want to output build artefacts on host machine>:/target
-
In the root folder of your Scala project create Dockerfile file the similar content:
FROM alekslitvinenk/sbt:latest COPY . .
-
Build image:
docker build -t <your image derived from alekslitvinenk/sbt>
-
Run sbt container:
docker run -v <host output directory>:/target <your image derived from alekslitvinenk/sbt> sbt compile
Example:
docker run -v ~/dist:/target alekslitvinenk/dockovpn-it sbt compile