mirror of https://github.com/docker/cli.git
Merge pull request #4752 from vvoland/ci-bin-image
ci: Add bin-image workflow
This commit is contained in:
commit
d469be256e
|
@ -4,6 +4,9 @@ concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
VERSION: ${{ github.ref }}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
|
@ -86,6 +89,50 @@ jobs:
|
||||||
path: /tmp/out/*
|
path: /tmp/out/*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
|
bin-image:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
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
|
||||||
|
|
||||||
prepare-plugins:
|
prepare-plugins:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
outputs:
|
outputs:
|
||||||
|
|
|
@ -124,4 +124,4 @@ FROM scratch AS plugins
|
||||||
COPY --from=build-plugins /out .
|
COPY --from=build-plugins /out .
|
||||||
|
|
||||||
FROM scratch AS binary
|
FROM scratch AS binary
|
||||||
COPY --from=build /out .
|
COPY --from=build /out/docker /docker
|
||||||
|
|
|
@ -165,3 +165,26 @@ target "e2e-gencerts" {
|
||||||
dockerfile = "./e2e/testdata/Dockerfile.gencerts"
|
dockerfile = "./e2e/testdata/Dockerfile.gencerts"
|
||||||
output = ["./e2e/testdata"]
|
output = ["./e2e/testdata"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
target "docker-metadata-action" {
|
||||||
|
tags = ["cli-bin:local"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "bin-image" {
|
||||||
|
inherits = ["binary", "docker-metadata-action"]
|
||||||
|
output = ["type=docker"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "bin-image-cross" {
|
||||||
|
inherits = ["bin-image"]
|
||||||
|
output = ["type=image"]
|
||||||
|
platforms = [
|
||||||
|
"linux/amd64",
|
||||||
|
"linux/arm/v6",
|
||||||
|
"linux/arm/v7",
|
||||||
|
"linux/arm64",
|
||||||
|
"linux/ppc64le",
|
||||||
|
"linux/s390x",
|
||||||
|
"windows/amd64"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,13 @@ else
|
||||||
BUILDTIME=${BUILDTIME:-$(TZ=UTC date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +"%Y-%m-%dT%H:%M:%SZ")}
|
BUILDTIME=${BUILDTIME:-$(TZ=UTC date -u --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +"%Y-%m-%dT%H:%M:%SZ")}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$VERSION" in
|
||||||
|
refs/tags/v*) VERSION=${VERSION#refs/tags/v} ;;
|
||||||
|
refs/tags/*) VERSION=${VERSION#refs/tags/} ;;
|
||||||
|
refs/heads/*) VERSION=$(echo "${VERSION#refs/heads/}" | sed -r 's#/+#-#g') ;;
|
||||||
|
refs/pull/*) VERSION=pr-$(echo "$VERSION" | grep -o '[0-9]\+') ;;
|
||||||
|
esac
|
||||||
|
|
||||||
GOOS="$(go env GOOS)"
|
GOOS="$(go env GOOS)"
|
||||||
GOARCH="$(go env GOARCH)"
|
GOARCH="$(go env GOARCH)"
|
||||||
if [ "${GOARCH}" = "arm" ]; then
|
if [ "${GOARCH}" = "arm" ]; then
|
||||||
|
|
Loading…
Reference in New Issue