I am trying to run my scala application in a docker container with 800MB of RAM, (
docker run -m=800m mindlevel
[info] Compiling 10 Scala sources to /root/mindlevel-backend/target/scala-2.12/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.12.1. Compiling...
[info] Compilation completed in 8.631 s
/usr/local/sbt/bin/sbt-launch-lib.bash: line 58: 57 Killed "$@"
CMD ["sbt", "-mem", "700", "run"]
To get it to run with less than 1GB heap I precompiled the project with
sbt assembly which makes a jar packaged with your project and all of your dependencies.
Install it by adding:
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
Then generate the jar with
sbt assembly which will place the jar in
Then simply run your project with:
Since no compilation step is needed on the low memory instance now a lot of projects will be able to run even though it is less memory than recommended.