Giter Club home page Giter Club logo

docker-ci-template's Introduction

Docker CI Template

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.

Usage

Click on Use this template:

And follow the preparation steps.

Preparation

Github Token App

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:

Repository config

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.

Secrets

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

docker-ci-template's People

Contributors

mietzen avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.