Skip to content

Commit

Permalink
Update usage on README
Browse files Browse the repository at this point in the history
  • Loading branch information
fagiani authored Jul 5, 2022
1 parent 4b09f4e commit ba7dd3c
Showing 1 changed file with 2 additions and 64 deletions.
66 changes: 2 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ This buildpack builds on top of the existing [Node.js Engine Cloud Native Buildp

## Usage

This buildpack is not meant to be used on its own, and instead should be in used in combination with other buildpacks.

Include a list of `apt` package names to be installed in a file named `Aptfile`; be aware that line ending should be LF, not CRLF.

The buildpack automatically downloads and installs the packages when you run a build:
This buildpack is meant to be used with `heroku/nodejs-engine` version `0.7.3`.

```
$ pack build --buildpack fagiani/nodejs-yarn myapp
$ pack build --buildpack heroku/[email protected] --buildpack fagiani/nodejs-yarn myapp
```

### Define a custom path for yarn (optional)
Expand All @@ -29,64 +25,6 @@ You can optionally create a `yarn.lock` file in the root directory with a line l

Make sure you place the actual `package.json` and `yarn.lock` in that path

### Build the image

#### with buildpacks

Using pack, you're ready to create an image from the buildpack and source code. You will need to add flags that point to the path of the source code (`--path`) and the paths of the buildpacks (`--buildpack`).

```sh
cd nodejs-yarn-buildpack
pack build TEST_IMAGE_NAME --path ../TEST_REPO_PATH --buildpack ../nodejs-engine-buildpack --buildpack ../nodejs-yarn-buildpack
```

#### with a builder

You can also create a `builder.toml` file that will have explicit directions when creating a buildpack. This is useful when there are multiple "detect" paths a build can take (ie. yarn vs. npm commands).

In a directory outside of this buildpack, create a builder file:

```sh
cd ..
mkdir heroku_nodejs_builder
touch heroku_nodejs_builder/builder.toml
```

For local development, you'll want the file to look like this:

```toml
[[buildpacks]]
id = "heroku/nodejs-engine-buildpack"
uri = "../nodejs-engine-buildpack"

[[buildpacks]]
id = "heroku/nodejs-yarn-buildpack"
uri = "../nodejs-yarn-buildpack"

[[order]]
group = [
{ id = "heroku/nodejs-engine-buildpack", version = "0.0.1" },
{ id = "heroku/nodejs-yarn-buildpack", version = "0.0.1" }
]

[stack]
id = "heroku-18"
build-image = "heroku/pack:18"
run-image = "heroku/pack:18"
```

Create the builder with `pack`:

```sh
pack create-builder nodejs --builder-config ../heroku-nodejs-builder/builder.toml
```

Now you can use the builder image instead of chaining the buildpacks.

```sh
pack build TEST_IMAGE_NAME --path ../TEST_REPO_PATH --builder nodejs
```

## Contributing

1. Open a pull request.
Expand Down

0 comments on commit ba7dd3c

Please sign in to comment.