From c77c0f312a5ec694e0ef7507b11f3469247784f4 Mon Sep 17 00:00:00 2001 From: Anthony Dahanne Date: Fri, 15 Mar 2024 21:28:41 +0000 Subject: [PATCH] Add dualarch configuration --- buildpack.toml | 10 +++++++++- scripts/build.sh | 13 ++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/buildpack.toml b/buildpack.toml index 7011b4e..451e7f4 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -27,6 +27,14 @@ api = "0.7" type = "Apache-2.0" uri = "https://github.com/paketo-buildpacks/executable-jar/blob/main/LICENSE" +[[targets]] +os = "linux" +arch = "amd64" + +[[targets]] +os = "linux" +arch = "arm64" + [[stacks]] id = "io.buildpacks.stacks.bionic" @@ -50,4 +58,4 @@ build = true [metadata] pre-package = "scripts/build.sh" -include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/main", "buildpack.toml"] +include-files = ["LICENSE", "NOTICE", "README.md", "linux/amd64/bin/build", "linux/amd64/bin/detect", "linux/amd64/bin/main", "linux/arm64/bin/build", "linux/arm64/bin/detect", "linux/arm64/bin/main", "buildpack.toml"] diff --git a/scripts/build.sh b/scripts/build.sh index ee1b216..a3020d7 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,15 +2,18 @@ set -euo pipefail -GOOS="linux" go build -ldflags='-s -w' -o bin/main github.com/paketo-buildpacks/executable-jar/v6/cmd/main +GOOS="linux" go build -ldflags='-s -w' -o linux/amd64/bin/main github.com/paketo-buildpacks/executable-jar/v6/cmd/main +GOOS="linux" GOARCH="arm64" go build -ldflags='-s -w' -o linux/arm64/bin/main github.com/paketo-buildpacks/executable-jar/v6/cmd/main if [ "${STRIP:-false}" != "false" ]; then - strip bin/main + strip linux/amd64/bin/main linux/arm64/bin/main fi if [ "${COMPRESS:-none}" != "none" ]; then - $COMPRESS bin/main + $COMPRESS linux/amd64/bin/main linux/arm64/bin/main fi -ln -fs main bin/build -ln -fs main bin/detect +ln -fs main linux/amd64/bin/build +ln -fs main linux/arm64/bin/build +ln -fs main linux/amd64/bin/detect +ln -fs main linux/arm64/bin/detect