From 64f477e36c33afe8dfd87a839ba263e9973b0669 Mon Sep 17 00:00:00 2001 From: Nathan Fischer Date: Wed, 17 Apr 2019 17:58:05 -0700 Subject: Contrib module for building docker images --- docs/pages/9 - Contrib Modules.md | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'docs') diff --git a/docs/pages/9 - Contrib Modules.md b/docs/pages/9 - Contrib Modules.md index 1b9b55fa..9adddcc5 100644 --- a/docs/pages/9 - Contrib Modules.md +++ b/docs/pages/9 - Contrib Modules.md @@ -38,6 +38,50 @@ object project extends BuildInfo { * `def buildInfoPackageName: Option[String]`, default: `None` The package name of the object. +### Docker + +Automatically build docker images from your mill project. + +Requires the docker CLI to be installed. + +In the simplest configuration just extend `DockerModule` and declare a `DockerConfig` object. + +```scala +import mill._, scalalib._ + +import ivy`com.lihaoyi::mill-contrib-docker:VERSION` +import contrib.docker.DockerModule + +object foo extends JavaModule with DockerModule { + object docker extends DockerConfig +} +``` + +Then + +``` +$ mill foo.docker.build +$ docker run foo +``` + +#### Configuration + +Configure the image by overriding tasks in the `DockerConfig` object + +```scala +object docker extends DockerConfig { + // Override tags to set the output image name + def tags = List("aws_account_id.dkr.ecr.region.amazonaws.com/hello-repository") + + def baseImage = "openjdk:11" + + // Configure whether the docker build should check the remote registry for a new version of the base image before building. + // By default this is true if the base image is using a latest tag + def pullBaseImage = true +} +``` + +Run mill in interactive mode to see the docker client output, like `mill -i foo.docker.build`. ### Flyway -- cgit v1.2.3