console/.github/workflows/dockerize-cli.yaml
renovate[bot] 16b0e13989
chore(deps): pin dependencies (#6627)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-03-19 17:44:39 +02:00

79 lines
2.6 KiB
YAML

on:
workflow_call:
inputs:
registry:
default: ghcr.io
type: string
imageName:
default: ${{ github.repository_owner }}
type: string
cliVersion:
required: true
type: string
publishLatest:
default: false
type: boolean
jobs:
build-cli-docker-image:
name: Build CLI Docker Image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
pull-requests: write
steps:
- name: checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 2
- name: configure eqemu
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
with:
platforms: 'linux/arm64,linux/amd64'
- name: configure docker buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
- name: login to docker registry
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3
with:
registry: ${{ inputs.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Bake inputs
id: docker-bake-inputs
run: |
targets=$(docker buildx bake -f docker/docker.hcl --print build | jq -r '.group.build.targets[]')
input_set=""
first=0
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "set<<$EOF" >> "$GITHUB_ENV"
for target in $targets
do
echo "$target.cache-from=type=gha,ignore-error=true,scope=$GITHUB_REF-$target" >> "$GITHUB_ENV"
echo "$target.cache-to=type=gha,ignore-error=true,mode=max,scope=$GITHUB_REF-$target" >> "$GITHUB_ENV"
done
echo "$EOF" >> "$GITHUB_ENV"
- name: build docker images
timeout-minutes: 360
id: docker-bake
uses: docker/bake-action@5ca506d06f70338a4968df87fd8bfee5cbfb84c7 # v6.0.0
env:
DOCKER_REGISTRY: ${{ inputs.registry }}/${{ inputs.imageName }}/
COMMIT_SHA: ${{ inputs.cliVersion }}
RELEASE: ${{ inputs.cliVersion }}
BUILD_TYPE: 'publish'
PWD: ${{ github.workspace }}
BUILD_STABLE: ${{ inputs.publishLatest && '1' || '' }}
with:
# See https://github.com/docker/buildx/issues/1533
provenance: false
push: true
files: docker/docker.hcl
targets: cli
source: .
set: |
${{ steps.docker-bake-inputs.outputs.set }}