Skip to content

SBT in docker container to publish docker images. This image is based on docker image which is recommended for 'docker in docker' usage

Notifications You must be signed in to change notification settings

zahidadeel/sbt-dind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

sbt-dind: (sbt alongwith docker in docker environment)

In one scenario, I had to create an SBT container for scala code compilation, and publishing images through SBT's docker native packager plugin. So to facilitate me in that scenario, I created a docker image from official docker image which supports docker in docker use-case. While creating a docker container I am mounting /var/run/docker.sock inside container so that the docker service will create sibling containers or images with host machine's docker service. You can read further about it here

Build Image:

Build this image using following command:

docker build --build-arg SCALA_VERSION=2.12.10 --build-arg SBT_VERSION=1.2.8 -t docker-sbt .

Build Code with Docker Container:

Mount your ./code inside docker container and run SBT build commands through sh shell.

docker run -it --rm -v $(pwd)/code:/code -v /var/run/docker.sock:/var/run/docker.sock docker-sbt sh -c 'cd /code; sbt update; sbt "project data-service-deploy" "docker:publishLocal"'

Upon successful execution, a newly published image can be seen in the output of docker images.

About

SBT in docker container to publish docker images. This image is based on docker image which is recommended for 'docker in docker' usage

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published