Skip to content

Commit

Permalink
Add dualarch configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonydahanne committed Mar 15, 2024
1 parent ea728f2 commit c77c0f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
10 changes: 9 additions & 1 deletion buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"]
13 changes: 8 additions & 5 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c77c0f3

Please sign in to comment.