Skip to content

Commit

Permalink
Build multi arch binaries and add targets
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonydahanne committed Mar 12, 2024
1 parent 2f4f222 commit 9ba71ea
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

bin/
linux/
dependencies/
package/
scratch/
9 changes: 9 additions & 0 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ api = "0.7"
type = "Apache-2.0"
uri = "https://github.com/paketo-buildpacks/procfile/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", "bin/build.exe", "bin/detect.exe", "bin/main.exe", "buildpack.toml"]
pre-package = "scripts/build.sh"
Expand Down
16 changes: 8 additions & 8 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

set -euo pipefail

GOOS="linux" go build -ldflags='-s -w' -o bin/main github.com/paketo-buildpacks/procfile/v5/cmd/main
GOOS="windows" GOARCH="amd64" go build -ldflags='-s -w' -o bin/main.exe github.com/paketo-buildpacks/procfile/v5/cmd/main
GOOS="linux" go build -ldflags='-s -w' -o linux/amd64/bin/main github.com/paketo-buildpacks/procfile/v5/cmd/main
GOOS="linux" GOARCH="arm64" go build -ldflags='-s -w' -o linux/arm64/bin/main github.com/paketo-buildpacks/procfile/v5/cmd/main

if [ "${STRIP:-false}" != "false" ]; then
strip bin/main bin/main.exe
strip linux/amd64/bin/main linux/arm64/bin/main
fi

if [ "${COMPRESS:-none}" != "none" ]; then
$COMPRESS bin/main bin/main.exe
$COMPRESS linux/amd64/bin/main linux/arm64/bin/main
fi

ln -fs main bin/build
ln -fs main bin/detect
ln -fs main.exe bin/build.exe
ln -fs main.exe bin/detect.exe
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 9ba71ea

Please sign in to comment.