When building Docker images that are configured for WSO2 products, you can carryout the building process using different approaches based on a number of factors. The configuration steps that are involved in the Docker image build process is made extensible to allow diversity of approaches by using different provisioning methods.
build.sh helper script makes use of the specified provisioning methods to prepare the build process and subsequently configure the product inside. This involves two steps; therefore, the following two bash scripts are used for this purpose.
This script validates and prepares the folder that maintains the files needed to configure the image. This script exports a variable named
file_locationthat points to the folder where the
This script is called inside the Dockerfile when the
docker buildcommand is invoked. It will download the needed files from the specified
HTTP_PACK_SERVERand perform the configuration steps as needed.
HTTP_PACK_SERVER is a simple HTTP server, which hosts the relevant artifacts (product and JDK archives, etc.) used by the image building process.
Currently wso2/dockerfiles includes the following two provisioning methods:
The default provisioning method simply copies JDK and the product pack into the Docker image. If no provisioning method is specified when invoking the
build.shscript, the default provisioning method is selected. The relevant files should be available inside the
The Puppet provisioning method offers a Puppet related configuration option to build a product image by making use of WSO2 Puppet Modules and Hiera data to configure the product image. This provisioning method uses these Puppet modules to execute the
puppet applycommand when building the Docker image and configuring the product. The Puppet modules should be available at a separate location and the environment variable
PUPPET_HOMEshould point to that location.
When using a provisioning method to build a Docker image for a WSO2 product, execute the product's
build.sh script by passing the provisioning method name with the
build.sh script is run without the name of the provisioning method, the default provisioning method is used by default.
The following is an example of how the Puppet provisioning method is used.
The following is an example of how the default provisioning method is used.
Writing custom provisioning methods
Follow the steps below to write a custom provisioning method.
- Create two bash scripts named
- Place the above two scripts inside the
- Invoke the
build.shscript to build the Docker image using the custom provisioning method, by passing the provisioning method name with the