Building the customizations for containers
Complete this task to build your Order Hub customizations for containers.
Procedure
-
Prepare to deploy customizations.
The developer toolkit contains a devtoolkit_docker/orderhub-code/container-build/build-customization.sh script that builds and packages assets into a separate customization docker image.
-
Provide the Order Hub base docker image name and image tag as an input to the
build-customization.sh script.
Depending on how you plan to deploy, for example locally from a workstation or from a dedicated build machine, pass the input in one of the following ways.
- If the container-build folder is in
devtoolkit_docker/orderhub-code (for example, like it is in the toolkit), then
the image name and tag values are automatically taken from the
devtoolkit_docker/compose-orderhub/docker/oh-docker-compose.properties file.
- You do not have to do anything.
- If the container-build folder is not in
devtoolkit_docker/orderhub-code (for example, you are setting up a pipeline and
you are not copying all files from the toolkit), then complete one of the following steps:
- Copy the
devtoolkit_docker/compose-orderhub/docker/oh-docker-compose.properties file
from your toolkit installation to the
container-builddirectory that is being used for the build. - Set the ORDERHUB_EXT_DOCKER_IMAGE and ORDERHUB_EXT_DOCKER_TAG environment variables to use the applicable values.
- For example:
export ORDERHUB_EXT_DOCKER_IMAGE=om-orderhub-ext export ORDERHUB_EXT_DOCKER_TAG=22.2.6.0_20220524-2338
- Copy the
devtoolkit_docker/compose-orderhub/docker/oh-docker-compose.properties file
from your toolkit installation to the
- If the container-build folder is in
devtoolkit_docker/orderhub-code (for example, like it is in the toolkit), then
the image name and tag values are automatically taken from the
devtoolkit_docker/compose-orderhub/docker/oh-docker-compose.properties file.
-
Run
chmod +x build-customization.shto add permission for the build script. -
Run the build-customization.sh script to package customization assets into
a separate customization docker image. The script supports the following options.
- build-ui [ui-modules]
- Builds the specified modules, such as buc-app-order.
- build <image_name> <image_tag> [ui-modules]
- Builds a new customization docker image after the specified module build completes.
- build-image <image_name> <image_tag> [ui-modules]
- Builds a new customization docker image. This option assumes that the modules that are specified
are already built and available in the
distfolder of the module.Note: Make sure that you do not use the same <image_name> <image_tag> as the extension image provided by IBM.
Thebuild_customizationscript requires the following input:- The image name and tag of the Order Hub extensions container. This image will be
used as the base image for the customization image. The image name and tag can be passed in one of
the following ways:
- If the
container-builddirectory is indevtoolkit_docker/orderhub-code, then the image name and tag values are taken fromdevtoolkit_docker/compose-orderhub/docker/oh-docker-compose.properties. - Copy the file
devtoolkit_docker/compose-orderhub/docker/oh-docker-compose.propertiesfrom your toolkit installation to thecontainer-builddirectory that is used for the build. - Set the
ORDERHUB_EXT_DOCKER_IMAGEandORDERHUB_EXT_DOCKER_TAGenvironment variables. - Use the default values of
ORDERHUB_EXT_DOCKER_IMAGE=om-orderhub-extandORDERHUB_EXT_DOCKER_TAG=latest.
- If the
- The image name and tag of the customization image that will contain all the customized code.
These values are provided as command line input parameters to
build_customization.sh. The image name and tag combination must be different from the IBM Order Hub extensions container. It is recommended to use a tag that begins with "custom". For example, use image nameom-orderhub-extand image tagcustom-2020-08-26-0744. - A list of customized modules. This is a comma-separated list of the UI modules that have been
customized and any new modules. For example:
buc-app-order,buc-app-inventory,my-new-module.For a folder to be considered a module, the folder must contain a package.json file. If you do not specify ui-modules, then all folders in the parent directory of container-build are considered.
Note: If the build fails with the errorom-orderhub-extimage cannot be found ondocker.io, then the docker buildkit feature needs to be disabled so that it pulls the image from the local repository. Either:- Set the environment variable
DOCKER_BUILDKIT=0.
Or
- Set the buildkit feature configuration in
/etc/docker/daemon.jsontofalseand restart docker:{ "features": { "buildkit": false} }
The container build scripts support multiple modes for setting up the overall build pipeline.- Separate UI and docker image build:
In this mode, the UI modules are built separately with their build pipeline and the output of each module build is then brought together to generate the customization docker image (which is its own build pipeline)
- Build separate modules by running the following command.
The built assets are available in the dist folder, which you can upload to a central server. Then, you can package together the assets to build the customization docker image../build-customization.sh build-ui [ui-modules] - Build the customization docker image with a separate build pipeline by running the following
command.
./build-customization.sh build-image <image_name> <image_tag> [ui-modules]
- Build separate modules by running the following command.
- Single build for UI and docker image if the container-build folder
is in devtoolkit_docker/orderhub-code:In this mode, the UI modules and docker image are built in a single build pipeline.
./build-customization.sh build <image_name> <image_tag> [ui-modules]
For example, the modules buc-app-order and buc-app-inventory are customized. The customized image uses the same image name (om-orderhub-ext) as the IBM Order Hub extension container, but uses a unique image tag. The first step builds the modules. The second step builds the container image that contains the customized modules.
./build-customization.sh build-ui buc-app-order,buc-app-inventory ./build-customization.sh build-image om-orderhub-ext mycompany-2022-05-30-1755 buc-app-order,buc-app-inventory
What to do next
Complete the following task: Testing the customizations.