From d0dabf91a424eed5b39fde5554348f875e125569 Mon Sep 17 00:00:00 2001 From: Paul Gilber Date: Mon, 30 Oct 2023 09:46:19 +0000 Subject: [PATCH] create gha-build bake target --- .github/workflows/release.yml | 2 +- docker-bake.hcl | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6934a63..cc486d8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,5 +76,5 @@ jobs: set: | build.args.BUILD_IMAGE=${{ env.BUILD_IMAGE }} build.args.RUNTIME_IMAGE=${{ env.RUNTIME_IMAGE }} - targets: build + targets: gha-build push: true diff --git a/docker-bake.hcl b/docker-bake.hcl index 299934f..09ba4cc 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,16 +1,42 @@ // Configuration for docker/bake-action: https://github.com/docker/bake-action // https://github.com/marketplace/actions/docker-metadata-action#bake-definition // docker-bake.hcl + target "docker-metadata-action" {} +// Create Base Build Target target "build" { inherits = ["docker-metadata-action"] context = "./" // Use multi-stage Containerfile dockerfile = "Containerfile.multistage" +} + +// Create Platforms Target +target "platforms" { // Set target platforms for multi-platform builds https://docs.docker.com/build/bake/reference/#targetplatforms platforms = [ "linux/amd64", "linux/arm64" ] } + +// Create Multi Platform Build Target +target "multi-platform-build" { + inherits = ["build", "platforms"] +} + +// Create GitHub Action Cache Target +target "gha-cache" { + cache-from = [ + "type=gha" + ] + cache-to = [ + "type=gha,mode=max" + ] +} + +// Create GitHub Action Build Target +target "gha-build" { + inherits = ["multi-platform-build", "gha-cache"] +}