Skip to content

Build and push docker images #67

Build and push docker images

Build and push docker images #67

name: Build and push docker images
on:
workflow_dispatch:
inputs:
force_rebuild:
description: 'Force rebuild of all images'
default: false
type: boolean
build_deprecated_images:
description: 'Build deprecated images'
default: false
type: boolean
push:
branches:
- '**'
tags:
- 'v*'
env:
REGISTRY: ghcr.io
DOCKER_DIRECTORY: docker/images/
PLATFORMS: |
linux/amd64
# linux/arm64
# linux/arm/v7
jobs:
env-setup:
# Since env variables can't be passed to reusable workflows, we need to pass them as outputs
name: Evaluate force rebuild and set env variables as outputs
runs-on: ubuntu-22.04
outputs:
force_rebuild: ${{ steps.check.outputs.force_rebuild }}
docker_registry: ${{ steps.check.outputs.docker_registry }}
docker_directory: ${{ steps.check.outputs.docker_directory }}
platforms: ${{ steps.check.outputs.platforms }}
repository_name: ${{ steps.check.outputs.repository_name }}
build_deprecated_images: ${{ github.event.inputs.build_deprecated_images }}
steps:
- id: check
run: |
echo "force_rebuild=${{ inputs.force_rebuild || (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/' )) || false }}" >> $GITHUB_OUTPUT
echo "docker_registry=${{ env.REGISTRY }}" >> $GITHUB_OUTPUT
echo "docker_directory=${{ env.DOCKER_DIRECTORY }}" >> $GITHUB_OUTPUT
echo "platforms=${{ env.PLATFORMS }}" >> $GITHUB_OUTPUT
echo "repository_name=${{ github.event.repository.name }}" >> $GITHUB_OUTPUT
# Build deprecated images if not explicitly disabled
#TODO: set default to false, once backwards compatibility is no longer needed
echo "build_deprecated_images=${{ inputs.build_deprecated_images || true }}" >> $GITHUB_OUTPUT
# One job for each image, since the images build on top of each other a matrix strategy is not possible
everest-clang-format:
needs:
- env-setup
name: Build and push everest-clang-format docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: ${{ needs.env-setup.outputs.repository_name }}/everest-clang-format
directory: ${{ needs.env-setup.outputs.docker_directory }}/everest-clang-format
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}
run-env-base:
needs:
- env-setup
name: Build and push run-env-base docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: ${{ needs.env-setup.outputs.repository_name }}/run-env-base
directory: ${{ needs.env-setup.outputs.docker_directory }}/run-env-base
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}
build-env-base:
needs:
- env-setup
- run-env-base
name: Build and push build-env-base docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: ${{ needs.env-setup.outputs.repository_name }}/build-env-base
directory: ${{ needs.env-setup.outputs.docker_directory }}/build-env-base
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}
dev-env-base:
needs:
- env-setup
- build-env-base
name: Build and push dev-env-base docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: ${{ needs.env-setup.outputs.repository_name }}/dev-env-base
directory: ${{ needs.env-setup.outputs.docker_directory }}/dev-env-base
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}
build-kit:
needs:
- env-setup
- build-env-base
name: Build and push build-kit docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: ${{ needs.env-setup.outputs.repository_name }}/build-kit
directory: ${{ needs.env-setup.outputs.docker_directory }}/build-kit
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}
# Include deprecated images for backwards compatibility
deprecated-everest-clang-format:
if: ${{ needs.env-setup.outputs.build_deprecated_images == 'true' }}
needs:
- env-setup
name: Build and push deprecated everest-clang-format docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: everest-clang-format
directory: docker/deprecated-images/everest-clang-format
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}
deprecated-build-kit-alpine:
if: ${{ needs.env-setup.outputs.build_deprecated_images == 'true' }}
needs:
- env-setup
name: Build and push deprecated build-kit-alpine docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: build-kit-alpine
directory: docker/deprecated-images/build-kit
docker_file_name: alpine.Dockerfile
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}
deprecated-build-kit-debian:
if: ${{ needs.env-setup.outputs.build_deprecated_images == 'true' }}
needs:
- env-setup
name: Build and push deprecated build-kit-debian docker image
uses: ./.github/workflows/deploy-single-docker-image.yml
secrets:
SA_GITHUB_PAT: ${{ secrets.SA_GITHUB_PAT }}
SA_GITHUB_USERNAME: ${{ secrets.SA_GITHUB_USERNAME }}
with:
force_rebuild: ${{ needs.env-setup.outputs.force_rebuild == 'true' }}
image_name: build-kit-debian
directory: docker/deprecated-images/build-kit
docker_file_name: debian.Dockerfile
docker_registry: ${{ needs.env-setup.outputs.docker_registry }}
github_ref_before: ${{ github.event.before }}
github_ref_after: ${{ github.event.after }}
platforms: ${{ needs.env-setup.outputs.platforms }}