Skip to main content
In this lesson, you will learn how to package your buildpack. The process starts by creating a configuration file named package.toml in the root directory of your project. This configuration file instructs the pack tool on where to locate your buildpack code.

Step 1: Create the package.toml File

Begin by creating a file called package.toml in your project’s root directory with the following content:
This configuration tells the pack tool that your buildpack resides in the folder named js-buildpack. If your buildpack requires additional dependent buildpacks, you can include them in the package.toml file as demonstrated below:
For this example, no additional dependencies are needed, so the initial simple configuration is sufficient.

Step 2: Package the Buildpack

Next, package the buildpack by executing the following command. This command names your buildpack image “my-js-buildpack” and points the pack tool to the package.toml file located in your project root:
After running the command, you should see an output similar to the following:
This output confirms that your buildpack has been successfully packaged into a Docker image.

Step 3: Verify the Packaged Image

To confirm that the image has been created, list your Docker images by running:
The output should include your newly packaged buildpack image, resembling the following:

Step 4: Tag and Distribute the Buildpack Image

If you plan to distribute your buildpack image, you must tag the image with the proper repository identifier before pushing it to Docker Hub or another container registry. To tag the image, run:
After tagging your image, push it to the designated container registry using the appropriate Docker push command. This final step readies your buildpack for distribution. Happy building!

Watch Video