I have a simple Play! application with nothing special going on in the build.sbt
;
name := """project-name"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayScala)
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
jdbc,
javaJdbc,
javaEbean,
"mysql" % "mysql-connector-java" % "5.1.38",
cache,
ws,
"com.googlecode.libphonenumber" % "libphonenumber" % "7.1.0"
)
// string metrics
libraryDependencies += "com.rockymadden.stringmetric" %% "stringmetric-core" % "0.27.4"
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
And inside a Dockerfile
I'm attempting to build an executable of this application via the activator dist
, sbt dist
or activator stage
commands.
All of the above work flawlessly when I run it on my computer. However, when I run exactly the same commands from within a docker container, I notice;
sbt.ResolveException: download failed:
org.scalaz#scalaz-core_2.10;7.0.2!scalaz-core_2.10.jar(bundle)
I'm doubting if this is an error that has to do with SBT or something specific to Docker containers. Has anyone seen this before?
When you experience slow Docker performance, check your CPU, memory usage, and available disk space. Consider upgrading your system if a component does not perform as expected. When dealing with a specific container that is performing worse than expected, it may be helpful to check container-specific metrics.
The easiest way to increase the speed of your Docker image build is by specifying a cached image that can be used for subsequent builds. You can specify the cached image by adding the --cache-from argument in your build config file, which will instruct Docker to build using that image as a cache source.
By default, if an out-of-memory (OOM) error occurs, the kernel kills processes in a container. To change this behavior, use the --oom-kill-disable option. Only disable the OOM killer on containers where you have also set the -m/--memory option.
To limit the maximum amount of memory usage for a container, add the --memory option to the docker run command. Alternatively, you can use the shortcut -m . Within the command, specify how much memory you want to dedicate to that specific container.
Mounting the .ivy2
and .sbt
directories in the container increased the compiling speed significantly:
-v ~/.sbt:/root/.sbt -v ~/.ivy2:/root/.ivy2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With