Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
130 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'release/*' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
|
||
env: | ||
DOCKERHUB_SLUG: distribution/distribution | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v3 | ||
with: | ||
images: | | ||
${{ env.DOCKERHUB_SLUG }} | ||
### versioning strategy | ||
### push semver tag v2.9.0 on main (default branch) | ||
# distribution/distribution:2.9.0 | ||
# distribution/distribution:latest | ||
### push semver tag v2.8.0 on release/2.8 branch | ||
# distribution/distribution:2.8.0 | ||
### push on main | ||
# distribution/distribution:edge | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=ref,event=pr | ||
# don't create latest tag on release/2.x | ||
flavor: | | ||
latest=false | ||
labels: | | ||
org.opencontainers.image.title=Distribution | ||
org.opencontainers.image.description=The toolkit to pack, ship, store, and deliver container content | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build image | ||
uses: docker/bake-action@v1 | ||
with: | ||
files: | | ||
./docker-bake.hcl | ||
${{ steps.meta.outputs.bake-file }} | ||
targets: image-all | ||
push: ${{ startsWith(github.ref, 'refs/tags/') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
group "default" { | ||
targets = ["image-local"] | ||
} | ||
|
||
// Special target: https://github.com/docker/metadata-action#bake-definition | ||
target "docker-metadata-action" { | ||
tags = ["registry:local"] | ||
} | ||
|
||
target "binary" { | ||
target = "binary" | ||
output = ["./bin"] | ||
} | ||
|
||
target "image" { | ||
inherits = ["docker-metadata-action"] | ||
} | ||
|
||
target "image-local" { | ||
inherits = ["image"] | ||
output = ["type=docker"] | ||
} | ||
|
||
target "image-all" { | ||
inherits = ["image"] | ||
platforms = [ | ||
"linux/amd64", | ||
"linux/arm/v6", | ||
"linux/arm/v7", | ||
"linux/arm64", | ||
"linux/ppc64le", | ||
"linux/s390x" | ||
] | ||
} |