Skip to content

Commit 1f914ad

Browse files
Create packager utility
1 parent 041ea64 commit 1f914ad

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Node.js Cloud Native Buildpack
2+
3+
## Usage
4+
5+
To package this buildpack for consumption:
6+
7+
```
8+
$ ./scripts/package.sh
9+
```
10+
11+
This builds the buildpack's Go source using `GOOS=linux` by default. You can supply another value as the first argument to `package.sh`.

scripts/package.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
TARGET_OS=${1:-linux}
5+
6+
cd "$( dirname "${BASH_SOURCE[0]}" )/.."
7+
8+
echo "Target OS is $TARGET_OS"
9+
echo -n "Creating buildpack directory..."
10+
bp_dir=/tmp/"${PWD##*/}"_$(openssl rand -hex 12)
11+
mkdir $bp_dir
12+
echo "done"
13+
14+
echo -n "Copying buildpack.toml..."
15+
cp buildpack.toml $bp_dir/buildpack.toml
16+
echo "done"
17+
18+
# TODO: Update list of built binaries as they are written
19+
for b in detect build; do
20+
echo -n "Building $b..."
21+
GOOS=$TARGET_OS go build -o $bp_dir/bin/$b ./cmd/$b
22+
echo "done"
23+
done
24+
echo "Buildpack packaged into: $bp_dir"

0 commit comments

Comments
 (0)