DEV Community

Clemens Kaserer
Clemens Kaserer

Posted on

cookiecutter for container images

What is cookiecutter?!

Cookiecutter is a command-line utility that creates projects from cookiecutters (project templates), e.g. creating a Python package project from a Python package project template.

Sidenote

I maintain a containerized version of all cookiecutter releases starting with 1.7.0 at dockerhub.
If you want to know more check out the associated repository at github.com/ckaserer/cookiecutter or my blog post containerized cookiecutter.


Cookiecutter for container images

The goal of today is to standardize and automate your container image build process. From folder structure, to CICD, to publishing to a container registry, to build notifications via slack with cookiecutter templates.

Requirements

Getting stared

To process the docker-cookiecutter template execute

cookiecutter https://github.com/ckaserer/docker-cookiecutter

Here a quick look at the resulting target folder structure

docker-{{cookiecutter.image_name}}
├── .ci
│   └── test.sh                     <- put your tests here
├── .dockerignore                   <- ignore files when building
├── .github                         <- github issue templates
│   └── ISSUE_TEMPLATE
│       ├── bug_report.md
│       └── feature_request.md
├── .gitignore
├── .travis.yml                     <- slack notifications for our tests
├── CODE_OF_CONDUCT.md
├── Dockerfile                      <- what we actually want
├── LICENSE
├── README.md                       <- badges and quickstart info
└── bashrc                          <- bash functions for easy of use

Next, we need to add our registry credentials to be able to push our images to a container registry and our slack integration for build notifications.
You can find a how-to for those steps in the README.md of your processed docker-cookiecutter template or directly via this link.


Source

Top comments (0)