This template will automatically build, release and push docker images for you as soon as a new base image is available.
Simply place a Dockerfile
at the root of the repo e.g.:
FROM debian:bookworm-20240211
RUN apt-get update && apt-get install -y \
fortune \
cowsay \
&& rm -rf /var/lib/apt/lists/*
RUN echo '/usr/games/fortune | /usr/games/cowsay && echo -e "\n"' >> /etc/bash.bashrc
Is important not to use a tag like latest
, stable
or any other tag that is not regular updated. For debian there are for example images with a date inside the tag.
The workflows will automatically build and release a new debian images with a cowsay
message of the day under the following name: {DOCKER_HUB_USERNAME}/{REPO_NAME}:{BASE_IMAGE_TAG}
e.g.: mietzen/debian-cowsay:bookworm-20240211
(The latest image also gets the latest
tag)
Cowsay Example: https://github.com/mietzen/debian-cowsay
The workflow will build all platform listed in platforms.json
and also push them as a multi-arch image.
Click on Use this template
:
And follow the preparation steps.
For the workflow to run you need to create a GitHub-App to generate tokens, follow:
https://github.com/actions/create-github-app-token
If you follow the instructions above you should have your App listed under Settings -> GitHub Apps
:
You need to activate auto-merge
under Settings -> General -> Pull Requests
:
and setup the branch protection for main
under Settings -> Branch -> Add branch protection rule
, for Branch name pattern
type in main
:
Then apply the following settings:
The status check Check-Build
is only available after the docker-image.yml
ran at least one time. You can trigger the workflow by simply opening a Pull-Request e.g. to add your Dockerfile
.
You need to add the following secrets as repository secrets in Actions:
APP_ID
APP_PRIVATE_KEY
DOCKER_HUB_DEPLOY_KEY
and to Dependabot:
APP_ID
APP_PRIVATE_KEY
[Optional] Add your DockerHub username and/or the docker image name under variables:
DOCKER_HUB_USERNAME
IMAGE_NAME