Docker Data Volume for SBT Dependencies

I am using docker for continuous integration of a Scala project. Inside the container I am building the project and creating a distribution with “sbt dist”.

This takes ages pulling down all the dependencies and I would like to use a docker data volume as mentioned here: http://docs.docker.io/en/latest/use/working_with_volumes/

  • Docker Stack Swarm - Service Replicas are not spread for Mutli Service Stack
  • Kubernetes locally via docker persistence
  • docker cp doesn't work for this mysql container
  • How can I pass the argument to docker-compose.yml using shell file
  • Should Docker be used in a non devops, not very agile environment? [closed]
  • 404 error when Accessing from local host : NGINX uWSGI
  • However, I don’t understand how I could get SBT to put the jar files in the volume, or how SBT would know how to read them from that volume.

  • docker can I mount os from another container
  • Prevent request too quickly in bash
  • Ubuntu dockerfile - mailutils install
  • 403 error on PHP files with nginx, PHP-FPM and docker
  • How can we mount volume on a container that's running without commit, stopping or pausing it?
  • Connection refused when running mongo DB command in docker
  • 2 Solutions collect form web for “Docker Data Volume for SBT Dependencies”

    SBT uses ivy to resolve project dependencies. Ivy caches downloaded artifacts locally and every time it is asked to pull something, it first goes to that cache and if nothing found downloads from remote. By default cache is located in ~/.ivy2, but it is actually a configurable property. So just mount volume, point ivy to it (or mount it in a way it will be on default location) and enjoy the caches.

    Not sure if this makes sense on an integration server, but when developing on localhost, I’m mapping my host’s .ivy2/ and .sbt/ directories to volumes in the container, like so:

    docker run ...  -v ~/.ivy2:/root/.ivy2  -v ~/.sbt:/root/.sbt  ...
    

    (Apparently, inside the container, .ivy2/ and .sbt/ are placed in /root/, since we’re logging in to the container as the root user.)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.