Skip to content

Latest commit

 

History

History
111 lines (86 loc) · 3.94 KB

File metadata and controls

111 lines (86 loc) · 3.94 KB

Example of automatically building container images

There are several ways to automatically build container/docker images.
Here are a few examples:

GitHub Actions

Note: GitHub Actions can also be used with Gitea and Forgejo. ;-)

Docs:

Actions:

Project tree

.
├── .github
    ├── actions
    |   ├── docker-setup
    |   |   └── action.yml
    |   └── ...
    └── workflows
        ├── build_docker_images.yaml
        ├── build_docker_images_withMatrixAndOwnAction.yml
        └── ... 
├── Dockerfile(s)
└── ...

Description

  • .github/workflows/build_docker_images.yaml Workflow-File example for build Docker Images (Multiarch)
  • Workflow with Matrix and use own (composite) Action for building Multiarch Docker Images:
    • .github/actions/docker-setup/action.yml is my docker-setup action, that can include in Workflows with
      uses: tob1as/docker-build-example/.github/actions/docker-setup@main
      (Note: You can also use the full commit SHA if you don't want to use main.)
      or when you copy the action:
      uses: ./.github/actions/docker-setup
    • .github/workflows/build_docker_images_withMatrixAndOwnAction.yml Workflow-File with Matrix and use own Action.
    • It is used in my GitHub Repository: docker-php

GitLab

For GitLab use the .gitlab-ci.yml as an example.
More see in Docs.

Docker Hub Hook

Note: My examples are outdated, i recommend using GitHub Actions.

Docs:

Project tree

Example for advanced options (hooks) and buildx for Autobuild on Docker Hub to build Multiarch Images

.
├── hooks
    ├── pre_build
    ├── build
    └── push
├── Dockerfile
└── ... more Dockerfiles

Dockerfile(s)

.
├── alpine.Dockerfile
├── debian.Dockerfile
├── distroless.debian.Dockerfile
└── scratch.Dockerfile

This examples creates a (simple) Go application. It uses multistages and different runtime containers (with and without shell).
For more examples see in my other Repositories!

more Docs

Example Repositories

More examples can be found in my repositories. Here is a selection: