/lein-docker

A leiningen plugin to build docker images and deploy them.

Primary LanguageClojureMIT LicenseMIT

lein-docker

A Leiningen plugin to build and deploy Docker images.

Clojars Project

Usage

Add docker-deploy to your plugin list in your project.clj:

:plugins [[gorillalabs/lein-docker "1.3.0"]]

(see version badge above for newest release)

Available commands:

$ lein docker build
$ lein docker push
$ lein docker rmi

Configuration

You can add the following configuration options at the root of your project.clj:

:docker {:image-name "myregistry.example.org/myimage"
         :tags ["%s" "latest"] ; %s will splice the project version into the tag
         :dockerfile "target/dist/Dockerfile"
         :build-dir  "target"}

Defaults:

  • :image-name is your project's name (without the group ID)
  • :tags is your project's version
  • :dockerfile points to Dockerfile
  • :build-dir points to the project's root

Releasing your docker images

You can use Leiningen to handle your technical release process. In order to do that with your Docker image instead of your plain jar file, configure your release tasks similar to that:

:release-tasks [["vcs" "assert-committed"]
                ["change" "version" "leiningen.release/bump-version" "release"]
                ["vcs" "commit"]
                ["vcs" "tag"]
                ["clean"]
                ["uberjar"]
                ["docker" "build"]
                ["docker" "push"]
                ["change" "version" "leiningen.release/bump-version"]
                ["vcs" "commit"]
                ["vcs" "push"]]

License

MIT License

Copyright (c) 2015, Tobias Sarnowski 2018, Dr. Christian Betz