forked from moby/buildkit
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (75 loc) · 2.3 KB
/
buildx-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# source latest
# dest buildx-stable-1
# result moby/buildkit:latest > moby/buildkit:buildx-stable-1
# moby/buildkit:rootless > moby/buildkit:buildx-stable-1-rootless
#
# source v0.8.1
# dest buildx-stable-1
# result moby/buildkit:v0.8.1 > moby/buildkit:buildx-stable-1
# moby/buildkit:v0.8.1-rootless > moby/buildkit:buildx-stable-1-rootless
name: buildx-image
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
source-tag:
description: 'BuildKit source Docker tag'
required: true
default: 'latest'
dest-tag:
description: 'Default BuildKit Docker tag for buildx'
required: true
default: 'buildx-stable-1'
dry-run:
description: 'Dry run'
required: false
default: 'true'
env:
SETUP_BUILDX_VERSION: "latest"
REPO_SLUG_TARGET: "moby/buildkit"
jobs:
create:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
flavor:
- ''
- 'rootless'
steps:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ env.SETUP_BUILDX_VERSION }}
buildkitd-flags: --debug
-
name: Login to DockerHub
if: github.event.inputs.dry-run != 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Create
run: |
DRYRUN_FLAG=""
if [ "${{ github.event.inputs.dry-run }}" = "true" ]; then
DRYRUN_FLAG="--dry-run"
fi
SOURCE_TAG="${{ github.event.inputs.source-tag }}"
DEST_TAG="${{ github.event.inputs.dest-tag }}"
if [ "${{ matrix.flavor }}" != "" ]; then
if [ "$SOURCE_TAG" = "latest" ]; then
SOURCE_TAG="${{ matrix.flavor }}"
else
SOURCE_TAG="${SOURCE_TAG}-${{ matrix.flavor }}"
fi
DEST_TAG="${DEST_TAG}-${{ matrix.flavor }}"
fi
set -x
docker buildx imagetools create ${DRYRUN_FLAG} --tag \
"${{ env.REPO_SLUG_TARGET }}:${DEST_TAG}" \
"${{ env.REPO_SLUG_TARGET }}:${SOURCE_TAG}"