Configure Polywrap build pipeline
In this section, we'll explore the Polywrap's build pipeline and how to configure it. This article will help you understand the follow concepts:
- Polywrap's build pipeline
- Customizing the Build Manifest file
- Customizing the Dockerfile
The build process begins by running the
build command from the
The command will first search for the Polywrap Manifest, find the wrapper schema and implementation, and move these files into a Docker image.
Within the docker image, the wrapper schema is parsed and its contents are extracted into an ABI.
The ABI is used to generate binding code for the wrapper.
The wrapper is then compiled into a Wasm module.
The ABI and the Polywrap Manifest are merged into a Wrap Manifest file called
While the default build settings work well for many projects, the toolchain offers a highly configurable build pipeline for those who need more customization.
The Build Manifest
polywrap.build.yaml file is the entry point to build pipeline configuration.
The location of the Build Manifest must be declared in your Polywrap Manifest with a field labeled build. If a custom build manifest is not declared, the default build configuration will be used.
- Default Configuration
#Customizing the Dockerfile
Those who need to fully customize the Docker image build steps can customize the Dockerfile. The Dockerfile is a text file containing instructions for Docker to build images. You can learn more about it at Docker's Dockerfile documentation.
To begin, either copy the default Dockerfile from the
.polywrap/wasm/build/image folder or create your own.
Then, in the
polywrap.build.yaml file, add a key called
dockerfile with the path of the newly created Dockerfile as the value.
That's it! Now, you can customize the Dockerfile to your heart's content.
Mustache is a logic-less template system that can be used for HTML, config files, and more. You can learn more about writing Mustache templates here.
To enable Mustache capabilities for your Dockerfile, name your custom Dockerfile with a
.mustache file extension:
With Mustache, your Dockerfile will be able to recognize variable tags set within the
config field of the Build Manifest.
For example, in your Build Manifest file, you could have a key such as
foo with the value
hey like so:
To use this variable in your Mustache-enabled Dockerfile, simply reference the variable with curly braces like so: