A Leiningen plugin to perform simple docker tasks. Mainly intended for use in continuous-deployment pipelines.
In your project.clj, add a key:
:docker {:repo "foo/bar"}
$ lein docker build
Builds a docker image, using the dockerfile at the root of the project dir. Uses the repo name from the project.clj, and tags the image with the project.clj version. If the version contains SNAPSHOT, it will be replaced with the current datetime.
$ lein docker push [<version>]
Performs a simple docker push. Can optionally pass an explicit
version, or :latest
, which will push the most recent tag from this
repo.
$ lein docker lein <imgId or tag> <lein args>
Performs a docker run
on image, mounting this project's directory inside the container, then running leiningen inside the container with the supplied args. lein must already be installed on the container.
Optional Project config: In your project.clj or ~/.lein/profiles.clj, add the following to your :docker map
:sudo true
if docker requires sudo todocker run
:ports {}
a map, passed to -p for port mapping:env #{}
a set of environment variables that if present in the parent env, will be passed through to the child lein process:links {}
a map, passed to --links:m2-dest "/home/username/.m2/"
, will-v
mount ~/.m2/ to :m2-dest, dramatically speeds up lein deps
Copyright © 2015 Allen Rohner
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.