2021-09-26 12:01:38 -04:00
|
|
|
name: build
|
|
|
|
|
2022-08-18 14:03:28 -04:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2024-01-03 04:07:34 -05:00
|
|
|
env:
|
|
|
|
VERSION: ${{ github.ref }}
|
|
|
|
|
2021-09-26 12:01:38 -04:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
2023-02-09 12:03:11 -05:00
|
|
|
- '[0-9]+.[0-9]+'
|
2021-09-26 12:01:38 -04:00
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
2023-03-27 22:22:16 -04:00
|
|
|
prepare:
|
2024-02-13 08:30:09 -05:00
|
|
|
runs-on: ubuntu-22.04
|
2023-03-27 22:22:16 -04:00
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.platforms.outputs.matrix }}
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 04:37:30 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-03-27 22:22:16 -04:00
|
|
|
-
|
|
|
|
name: Create matrix
|
|
|
|
id: platforms
|
|
|
|
run: |
|
|
|
|
echo "matrix=$(docker buildx bake cross --print | jq -cr '.target."cross".platforms')" >>${GITHUB_OUTPUT}
|
|
|
|
-
|
|
|
|
name: Show matrix
|
|
|
|
run: |
|
|
|
|
echo ${{ steps.platforms.outputs.matrix }}
|
|
|
|
|
2021-09-26 12:01:38 -04:00
|
|
|
build:
|
2024-02-13 08:30:09 -05:00
|
|
|
runs-on: ubuntu-22.04
|
2023-03-27 22:22:16 -04:00
|
|
|
needs:
|
|
|
|
- prepare
|
2021-09-26 12:01:38 -04:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
target:
|
2023-03-27 22:22:16 -04:00
|
|
|
- binary
|
|
|
|
- dynbinary
|
|
|
|
platform: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
2021-12-09 10:37:02 -05:00
|
|
|
use_glibc:
|
|
|
|
- ""
|
|
|
|
- glibc
|
2021-09-26 12:01:38 -04:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 04:37:30 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-10-11 14:01:46 -04:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2021-09-26 12:01:38 -04:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 04:24:45 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-09-26 12:01:38 -04:00
|
|
|
-
|
2023-03-27 22:22:16 -04:00
|
|
|
name: Build
|
2023-09-12 05:29:01 -04:00
|
|
|
uses: docker/bake-action@v4
|
2021-09-26 12:01:38 -04:00
|
|
|
with:
|
|
|
|
targets: ${{ matrix.target }}
|
2023-03-27 22:22:16 -04:00
|
|
|
set: |
|
|
|
|
*.platform=${{ matrix.platform }}
|
2021-12-09 10:37:02 -05:00
|
|
|
env:
|
|
|
|
USE_GLIBC: ${{ matrix.use_glibc }}
|
2021-09-26 12:01:38 -04:00
|
|
|
-
|
2023-03-27 22:22:16 -04:00
|
|
|
name: Create tarball
|
2021-09-26 12:01:38 -04:00
|
|
|
working-directory: ./build
|
|
|
|
run: |
|
2023-03-27 22:22:16 -04:00
|
|
|
mkdir /tmp/out
|
|
|
|
platform=${{ matrix.platform }}
|
|
|
|
platformPair=${platform//\//-}
|
|
|
|
tar -cvzf "/tmp/out/docker-${platformPair}.tar.gz" .
|
2021-12-09 10:37:02 -05:00
|
|
|
if [ -z "${{ matrix.use_glibc }}" ]; then
|
2024-05-30 09:53:25 -04:00
|
|
|
echo "ARTIFACT_NAME=${{ matrix.target }}-${platformPair}" >> $GITHUB_ENV
|
2021-12-09 10:37:02 -05:00
|
|
|
else
|
2024-05-30 09:53:25 -04:00
|
|
|
echo "ARTIFACT_NAME=${{ matrix.target }}-${platformPair}-glibc" >> $GITHUB_ENV
|
2021-12-09 10:37:02 -05:00
|
|
|
fi
|
2021-09-26 12:01:38 -04:00
|
|
|
-
|
|
|
|
name: Upload artifacts
|
2024-05-30 09:53:25 -04:00
|
|
|
uses: actions/upload-artifact@v4
|
2021-09-26 12:01:38 -04:00
|
|
|
with:
|
2021-12-09 10:37:02 -05:00
|
|
|
name: ${{ env.ARTIFACT_NAME }}
|
2023-03-27 22:22:16 -04:00
|
|
|
path: /tmp/out/*
|
2021-09-26 12:01:38 -04:00
|
|
|
if-no-files-found: error
|
2021-11-17 11:18:15 -05:00
|
|
|
|
2024-01-03 04:07:34 -05:00
|
|
|
bin-image:
|
2024-02-13 08:30:09 -05:00
|
|
|
runs-on: ubuntu-22.04
|
2024-01-03 04:07:34 -05:00
|
|
|
if: ${{ github.event_name != 'pull_request' && github.repository == 'docker/cli' }}
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
-
|
|
|
|
name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
|
|
|
images: dockereng/cli-bin
|
|
|
|
tags: |
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=sha
|
|
|
|
-
|
|
|
|
name: Login to DockerHub
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_CLIBIN_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_CLIBIN_TOKEN }}
|
|
|
|
-
|
|
|
|
name: Build and push image
|
|
|
|
uses: docker/bake-action@v4
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
./docker-bake.hcl
|
|
|
|
${{ steps.meta.outputs.bake-file }}
|
|
|
|
targets: bin-image-cross
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
set: |
|
|
|
|
*.cache-from=type=gha,scope=bin-image
|
|
|
|
*.cache-to=type=gha,scope=bin-image,mode=max
|
|
|
|
|
2023-03-27 22:22:16 -04:00
|
|
|
prepare-plugins:
|
2024-02-13 08:30:09 -05:00
|
|
|
runs-on: ubuntu-22.04
|
2023-03-27 22:22:16 -04:00
|
|
|
outputs:
|
|
|
|
matrix: ${{ steps.platforms.outputs.matrix }}
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 04:37:30 -04:00
|
|
|
uses: actions/checkout@v4
|
2023-03-27 22:22:16 -04:00
|
|
|
-
|
|
|
|
name: Create matrix
|
|
|
|
id: platforms
|
|
|
|
run: |
|
|
|
|
echo "matrix=$(docker buildx bake plugins-cross --print | jq -cr '.target."plugins-cross".platforms')" >>${GITHUB_OUTPUT}
|
|
|
|
-
|
|
|
|
name: Show matrix
|
|
|
|
run: |
|
|
|
|
echo ${{ steps.platforms.outputs.matrix }}
|
|
|
|
|
2021-11-17 11:18:15 -05:00
|
|
|
plugins:
|
2024-02-13 08:30:09 -05:00
|
|
|
runs-on: ubuntu-22.04
|
2023-03-27 22:22:16 -04:00
|
|
|
needs:
|
|
|
|
- prepare-plugins
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
platform: ${{ fromJson(needs.prepare-plugins.outputs.matrix) }}
|
2021-11-17 11:18:15 -05:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2023-09-05 04:37:30 -04:00
|
|
|
uses: actions/checkout@v4
|
2021-11-17 11:18:15 -05:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2023-09-12 04:24:45 -04:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2021-11-17 11:18:15 -05:00
|
|
|
-
|
2023-03-27 22:22:16 -04:00
|
|
|
name: Build
|
2023-09-12 05:29:01 -04:00
|
|
|
uses: docker/bake-action@v4
|
2021-11-17 11:18:15 -05:00
|
|
|
with:
|
|
|
|
targets: plugins-cross
|
2023-03-27 22:22:16 -04:00
|
|
|
set: |
|
|
|
|
*.platform=${{ matrix.platform }}
|