A simple tool for easily building and publishing Docker images inside Lerna monorepos.
Features:
- Building Docker images for all packages that have a Dockerfile.
- Pushing Docker images to Docker hub based.
- Automatic Docker hub authentication for running in CI environments.
- Bash (Installed by default on UNIX machines)
- Docker
- A Lerna project
This will automatically clone this repo into $HOME/.lerna-docker
(requires git),
and adds this tool to your $PATH
.
$ sh -c "`curl -fsSl https://raw.githubusercontent.com/rubensworks/lerna-docker/master/install.sh`"
If you want to uninstall later, just remove $HOME/.lerna-docker
and the $PATH
modification in ~/.bash_profile
.
First, clone this repo somewhere:
$ git clone [email protected]:rubensworks/lerna-docker.git
Then, add the /bin
folder to your $PATH
.
For example, by adding the following to your ~/.bash_profile
export PATH="/path/to/lerna-docker/bin:$PATH"
All actions allow a custom version tag to be passed.
If no version is given, then either a version based on $TRAVIS_TAG
or "DEV"
will be assigned.
Build all Dockerfiles that can be found in packages/*
:
$ lerna-docker my-docker-organization build [version-tag]
Pushing all images to Docker hub based on the Dockerfiles that can be found in packages/*
:
$ lerna-docker my-docker-organization push [version-tag]
If you want to push in a CI environment,
you will have to log in to a Docker Hub account,
which can be done by setting the (secret) environment variables DOCKER_USERNAME
and DOCKER_PASSWORD
.
This code is copyrighted by Ghent University โ imec and released under the MIT license.