SBT and Docker
SBT ("Simple" Build Tool)
- Defacto build tool for Scala
- Works well for Java too
- Handles retrieving dependencies
- Compiles code
- Uses incremental compilation
- Can be extended with plugins
- Build is configured with Scala (and provided DSL)
- More powerful than static config (xml and json)
- Also more complicated
Docker
- Powerful container engine
- Abstraction over operating systems
- Essentially a lightweight virtual machine
- Two phases: "build" and "run"
- Build takes a Dockerfile and makes an "image"
- Run takes and image and makes a "container"
- Builds very reproducible
- State is immutable and cached based on hashes
- Images are very portable
- They can be run anywhere the docker engine is installed
- Containers are very isolated
- Have their own network and filesystem
- Volumes can be mounted to persist and share state
iOffice Build Process
docker build -t builder .
docker run builder docker:publishLocal
docker tag iofficeconnect:1.0-SNAPSHOT staging2:latest
1
2
3
docker push staging2:latest
4
iOffice Build Process
- Step One
- We create a docker image from the Dockerfile in the root of the project
- Step Two
- Inside the builder we run "sbt docker:publishLocal"
- This triggers an sbt build of the app, which gets wrapped in a docker image when it's done
- Step Three
- The resulting "prod" image is tagged with its destination
- Step Four
- The tagged image is pushed to our docker registry
SBT and Docker
By Cameron Alexander
SBT and Docker
- 552