From ba795373fb7d31880d36d37ab6423d99e3b6db0d Mon Sep 17 00:00:00 2001 From: Finn-Thorben Sell Date: Sun, 10 Sep 2023 18:58:51 +0200 Subject: [PATCH] add github ci to build containers --- .github/workflows/build_all_containers.yml | 22 ++++++++++ .github/workflows/build_single_container.yml | 42 ++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/build_all_containers.yml create mode 100644 .github/workflows/build_single_container.yml diff --git a/.github/workflows/build_all_containers.yml b/.github/workflows/build_all_containers.yml new file mode 100644 index 0000000..a251800 --- /dev/null +++ b/.github/workflows/build_all_containers.yml @@ -0,0 +1,22 @@ +name: build all containers +on: + push: + branches: [ master, github_actions_ci ] + schedule: + - cron: "0 3 * * 1" # every monday + +permissions: + contents: read + packages: write + +jobs: + build_all_containers: + strategy: + fail-fast: false + matrix: + container: + - base-bullseye + uses: ./.github/workflows/build_single_container.yml + secrets: inherit + with: + container: ${{ matrix.container }} diff --git a/.github/workflows/build_single_container.yml b/.github/workflows/build_single_container.yml new file mode 100644 index 0000000..adbbb97 --- /dev/null +++ b/.github/workflows/build_single_container.yml @@ -0,0 +1,42 @@ +name: build_single_container +on: + workflow_dispatch: + inputs: &inputs + container: + description: Which container to build + type: string + required: true + workflow_call: + inputs: *inputs + +permissions: + contents: read + packages: write + +jobs: + build_container: + name: build ${{ inputs.container }} + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: login to container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: setup docker buildx + uses: docker/setup-buildx-action@v2 + + - name: build container + uses: docker/build-push-action@v4 + with: + context: ./${{ inputs.container }} + push: true + tags: ghcr.io/fsinfuhh/${{ inputs.container }}:latest + labels: | + org.opencontainers.image.title=${{ inputs.container }} + org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}