Create a Builder
Conveniently build a Builder project through Packer with almost no need to modify the code.
This article will use the
Leo smart contract as an example to introduce how to create a
To comply with the Buildpacks specification, creating a
Builder requires you to write a
builder.toml file listing the names of multiple other
Relationship between Builder, Meta-Buildpack, and Buildpack
To better understand the hierarchical relationship between
buildpack, let's continue to analyze with the example of
• At the
builder level, we refer to
leo-builder, which only contains
Meta-buildpack is a more comprehensive concept, which includes multiple underlying packages and a
Leo as an example, it covers
leo-dist buildpack and
Buildpack constitutes the lowest level implementation of the entire architecture, distributed across multiple repositories. Taking
leo-dist buildpack as an example, they respectively include the implementation of business logic, which are basically functions that all chains need to implement, such as wallet initialization, fetch devnet faucet, contract compilation, contract deployment, and other important operations. These operations often require a significant amount of time to complete, reflecting the understanding and familiarity with smart contracts and blockchain knowledge.
Here are the steps to initialize a
Builderconfiguration file named
config.tomlfile, specify the dependencies of the
Meta Buildpackyou wish to combine, for example:
repo = "amp-buildpacks/leo"
version = "0.1.7"
Packer CLItool to initialize your
Run the official
pack buildercommand to build your
Initializing the Project
1. Directly create the project and corresponding folders
packer init -t builder -c config.toml leo-builder
2. Use in an empty folder
First, go into an empty folder, then run:
packer init -t builder -c config.toml
3. Force overwrite an existing project
If you wish to overwrite an existing project, you can use the following command:
packer init -t builder -f -c config.toml leo-builder
Please note that using the
-foption will forcefully overwrite the existing project and all its contents. Before performing this operation, make sure you have fully backed up the project to prevent any unexpected issues.
This will complete the creation of the
Check the project file tree, and you will find the following related files have been automatically created:
> tree .github .