||
Skip to end of metadata
Go to start of metadata

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.

The 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.

  1. image-prep.sh
    This script validates and prepares the folder that maintains the files needed to configure the image. This script exports a variable named file_location that points to the folder where the HTTP_PACK_SERVER is started.
  2. image-config.sh
    This script is called inside the Dockerfile when the docker build command is invoked. It will download the needed files from the specified HTTP_PACK_SERVER and 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:

  1. default
    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.sh script, the default provisioning method is selected. The relevant files should be available inside the <DOCKERFILES_HOME>/common/provision/default/files folder.
  2. puppet
    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 apply command when building the Docker image and configuring the product. The Puppet modules should be available at a separate location and the environment variable PUPPET_HOME should 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 -r flag.

./build.sh -v <PRODUCT_VERSION> -r <PROVISIONING_METHOD_NAME>

If 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.

./build.sh -v 1.10.0 -r puppet

The following is an example of how the default provisioning method is used.

./build.sh -v 1.10.0 -r default

Writing custom provisioning methods

Follow the steps below to write a custom provisioning method.

  1. Create two bash scripts named image-prep.sh and image-config.sh.
  2. Place the above two scripts inside the <DOCKERFILES_HOME>/common/provision/<PROVISIONING_METHOD_NAME>/ folder.
  3. Invoke the build.sh script to build the Docker image using the custom provisioning method, by passing the provisioning method name with the -r flag.

For a basic example, refer to the default provisioning method.

  • No labels