diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c8063a..cd1926a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -177,3 +177,38 @@ jobs: name: Dump context if: always() uses: crazy-max/ghaction-dump-context@v1 + + bake: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: ./ + with: + images: | + ${{ env.DOCKER_IMAGE }} + ghcr.io/name/app + tag-sha: true + tag-semver: | + {{version}} + {{major}}.{{minor}} + {{major}} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Build + uses: crazy-max/ghaction-docker-buildx-bake@v1 + with: + files: | + ./test/docker-bake.hcl + ${{ steps.docker_meta.outputs.bake-file }} + targets: | + release diff --git a/README.md b/README.md index 947ca31..053b136 100644 --- a/README.md +++ b/README.md @@ -171,15 +171,11 @@ target named `ghaction-docker-meta`. ```hcl // docker-bake.hcl -target "ghaction-docker-meta" { - tags = ["crazymax/diun:local"] - labels = { - "maintainer" = "CrazyMax" - } -} + +target "ghaction-docker-meta" {} target "build" { - inherits = ["docker-meta"] + inherits = ["ghaction-docker-meta"] context = "./" dockerfile = "Dockerfile" platforms = ["linux/amd64", "linux/arm/v6", "linux/arm/v7", "linux/arm64", "linux/386", "linux/ppc64le"] diff --git a/test/docker-bake.hcl b/test/docker-bake.hcl new file mode 100644 index 0000000..3148894 --- /dev/null +++ b/test/docker-bake.hcl @@ -0,0 +1,39 @@ +group "default" { + targets = ["db", "app"] +} + +group "release" { + targets = ["db", "app-plus"] +} + +target "db" { + context = "./test" + tags = ["docker.io/tonistiigi/db"] +} + +target "app" { + context = "./test" + dockerfile = "Dockerfile" + args = { + name = "foo" + } + tags = [ + "localhost:5000/name/app:latest", + "localhost:5000/name/app:1.0.0" + ] +} + +target "cross" { + platforms = [ + "linux/amd64", + "linux/arm64", + "linux/386" + ] +} + +target "app-plus" { + inherits = ["app", "cross"] + args = { + IAMPLUS = "true" + } +}