From 6322bceac30bfd4e9ce52fe6b8d4e31213bc53cb Mon Sep 17 00:00:00 2001 From: Anthony Dahanne Date: Fri, 15 Mar 2024 23:09:34 +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 74fef07..d344b83 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -27,8 +27,16 @@ api = "0.7" type = "Apache-2.0" uri = "https://github.com/paketo-buildpacks/gradle/blob/main/LICENSE" +[[targets]] +os = "linux" +arch = "amd64" + +[[targets]] +os = "linux" +arch = "arm64" + [metadata] - 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"] pre-package = "scripts/build.sh" [[metadata.configurations]] diff --git a/scripts/build.sh b/scripts/build.sh index d41d62d..36bf03d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,15 +2,18 @@ set -euo pipefail -GOOS="linux" go build -ldflags='-s -w' -tags osusergo -o bin/main github.com/paketo-buildpacks/gradle/v7/cmd/main +GOOS="linux" go build -ldflags='-s -w' -o linux/amd64/bin/main github.com/paketo-buildpacks/gradle/v7/cmd/main +GOOS="linux" GOARCH="arm64" go build -ldflags='-s -w' -o linux/arm64/bin/main github.com/paketo-buildpacks/gradle/v7/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