summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorCrazyMax <crazy-max@users.noreply.github.com>2023-01-01 17:47:17 +0100
committerCrazyMax <crazy-max@users.noreply.github.com>2023-01-01 18:03:01 +0100
commit8086f4012330d1c1058e07fc4e5e4522dd432c20 (patch)
tree6b90941a1dbb5022ad1c06a069802e56810f4bc7 /.github/workflows
parentd109e429dd69bbfc2b575c11e66cbd98364a860b (diff)
downloaddocker-8086f4012330d1c1058e07fc4e5e4522dd432c20.tar.gz
Dockerfile: use TARGETPLATFORM to build Docker
Better support for cross compilation so we can fully rely on `--platform` flag of buildx for a seamless integration. This removes unnecessary extra cross logic in the Dockerfile, DOCKER_CROSSPLATFORMS and CROSS vars and some hack scripts as well. Non-sandboxed build invocation is still supported and dev stages in the Dockerfile have been updated accordingly. Bake definition and GitHub Actions workflows have been updated accordingly as well. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ci.yml39
1 files changed, 26 insertions, 13 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7f2c7821ff..a34abc2425 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -54,23 +54,36 @@ jobs:
if-no-files-found: error
retention-days: 7
+ prepare-cross:
+ runs-on: ubuntu-latest
+ needs:
+ - validate-dco
+ outputs:
+ matrix: ${{ steps.platforms.outputs.matrix }}
+ steps:
+ -
+ name: Checkout
+ uses: actions/checkout@v3
+ -
+ name: Create matrix
+ id: platforms
+ run: |
+ matrix="$(docker buildx bake binary-cross --print | jq -cr '.target."binary-cross".platforms')"
+ echo "matrix=$matrix" >> $GITHUB_OUTPUT
+ -
+ name: Show matrix
+ run: |
+ echo ${{ steps.platforms.outputs.matrix }}
+
cross:
runs-on: ubuntu-20.04
needs:
- validate-dco
+ - prepare-cross
strategy:
fail-fast: false
matrix:
- platform:
- - linux/amd64
- - linux/arm/v5
- - linux/arm/v6
- - linux/arm/v7
- - linux/arm64
- - linux/ppc64le
- - linux/s390x
- - windows/amd64
- - windows/arm64
+ platform: ${{ fromJson(needs.prepare-cross.outputs.matrix) }}
steps:
-
name: Checkout
@@ -89,9 +102,9 @@ jobs:
name: Build
uses: docker/bake-action@v2
with:
- targets: cross
- env:
- DOCKER_CROSSPLATFORMS: ${{ matrix.platform }}
+ targets: binary
+ set: |
+ *.platform=${{ matrix.platform }}
-
name: Upload artifacts
uses: actions/upload-artifact@v3