/docker-3musketeers

🐳 A lightweight Docker image with make, zip, git, curl, and Cookiecutter

Primary LanguageMakefileMIT LicenseMIT

Build Status Project status License Docker Build Status

Docker - 3musketeers

🐳 Lightweight image with essential tools for a 3 Musketeers project.

Tools

make

The 3 Musketeers pattern suggests a make target to call a make _target using Compose. However, make would often be in big images like Golang stretch and not in small ones like Alpine. Not every project needs big images. There are solutions in the 3 Musketeers Guidelines to what to do when the desired image does not have make.

See Echo example.

zip

Another suggested pattern is to zip your dependencies. Even big images like Golang stretch does not include zip. It does include tar which you can use but sometimes a zip file is required like when deploying your Lambda function to AWS.

curl

Useful utility to use instead of wget.

Cookiecutter & git

The cherry on top! Cookiecutter is used for 3 Musketeers examples and this image allows use to generete them with the only need of Docker! Cookiecutter needs git to download from a url.

Usage

# build image
make build

# test image
make test

# go inside a 3Musketeers container
make shell

# use 3musketeers image to generate from a Cookiecutter template
docker run -it --rm -v $PWD:/opt/app -w /opt/app flemay/3musketeers cookiecutter https://github.com/flemay/3mkts-cookiecutter-echo

Versioning

This image will always be built with the tag latest so tools will always be up to date. This may cause issues if any tool has a breaking change. For instance, if Cookiecutter introduces a breaking change then the Cookiecutter templates may need to be updated.

Automated build process

In a nutshell, any change to master triggers a Travis build and if the tests passed it triggers a Docker Hub build. The automatic build on Docker Hub has been disabled ensuring the build process goes only through Travis.

A cron task in Travis triggers a build every month making the image as fresh as possible automatically.