Create custom ts-app and ts-web Docker images

In this lesson, you create the custom Docker images for your Transaction server (ts-app) and Transaction web server (ts-web) from the contents of the WCB tool generated deployment package containing your migrated local store. These images can then be deployed into a live production environment to serve site traffic. For more information on building custom Docker images from deployment packages, see Building a custom Docker image from a deployable package.

Procedure

  1. Create your custom Transaction server (ts-app) Docker image.

    The Transaction server Docker image will contain the migrated local store assets, along with any other customizations that you included.

    1. Create a Dockerfile Docker configuration file with the following content.
      FROM Docker_registry/commerce/ts-app:source_image_tag
      RUN yum install -y nc && yum clean all
      HEALTHCHECK --retries=10 CMD nc localhost 5080 < /dev/nul
      COPY CusDeploy /SETUP/Cus
      RUN /SETUP/bin/applyCustomization.sh
      optional_commands
    2. Ready the custom deployment files.
      1. Create the CusDeploy subdirectory in the same directory as the Dockerfile created in step #1.a.
      2. Extract the Transaction server deployment package that you created in the previous lesson into the CusDeploy directory.
      3. Ensure that your deployment files are present:
        • The Stores.war store web archive is present within the CusDeploy/Code/ts-app/ directory.
        • Your migrated site configurations and security XML files, such as files that are related to AES encryption, are located within the CusDeploy/Code/ts-app/xml/config/ directory.
    3. Build the custom Transaction server (ts-app) Docker image.
      1. Open a command prompt and navigate to the directory containing your Dockerfile, and the CusDeploy subdirectory.
      2. Run the docker build command to build a custom Docker image for the Transaction server (ts-app).
        docker build -t ts-app:tag .
        For example:
        docker build -t ts-app:localstore-tag .
        Note:
        • Ensure that the period is present at the end of your docker build command.
        • The tag, like the deployment package build label, is used to identify the custom Docker image. You can modify this at any time to help identify the generated Docker image.
  2. Create your custom Transaction web server (ts-web) Docker image.

    All stores contain some static assets, such as product images, cascading style sheets, and front-end javascript files. These files are typically served by a web server. In HCL Commerce version 9, you can use the Transaction web server (ts-web) to serve these files.

    The default HTTP configuration of this server defines the alias /wcsstore to point to the /SETUP/Cus/ directory. Therefore all that is required is to add the static store files to the /SETUP/Cus directory. Since the dynamic assets, such as JSP files, are not served by the web server, you can remove these dynamic assets files from your Stores.war, and only copy the remaining static assets to ts-web.

    1. Create a package with the static assets for the local store.
      1. Extract the deployment package created in the previous lesson, wcbd-deploy-server-local-ts-V9.zip.
      2. Extract and copy all of the contents from the Stores.war, located within the Code/ts-app/ directory, to a new working directory, localStoreStaticAsset.
      3. Remove any dynamic files, such as JavaServer Page, and JavaServer Page Fragment files (JSP, and JSPF).
      4. Optional: Customizing the httpd.conf and plugin-cfg.xml configuration files is not required for local store deployment. However, you can customize them to add forward requests or request limitations. For more information, see Customizing the Web server Docker container.
    2. Create a Dockerfile Docker configuration file with the following configurations.
      FROM Docker_registry/commerce/ts-web:source_image_tag
      RUN yum install -y nc && yum clean all
      HEALTHCHECK --interval=10s CMD nc localhost 8000 < /dev/null
      #If you are using a local store from HCL Commerce Version 8 uncomment the next line.
      #COPY localStoreStaticAsset/ /SETUP/Cus/
      optional_commands
    3. Ensure that the directory containing your static assets, localStoreStaticAsset, is located on the same level as your new Dockerfile.
    4. Run the docker build command to build a custom Docker image for the Transaction web server (ts-web).
      docker build -t ts-web:tag .
      For example:
      docker build -t ts-web:localstore-tag .
      Note:
      • Ensure that the period is present at the end of your docker build command.
      • The tag, like the deployment package build label and ts-app tag, is used to identify the custom Docker image. You can modify this at any time to help identify the generated Docker image.

Results

Your deployment package, containing your migrated local store, is used to create custom Docker images for your Transaction server (ts-app) and Transaction web server (ts-web).

What to do next

These custom Docker images can now be deployed to your live production environment to serve site users on your migrated local store.

To continue with the tutorial, proceed to Deploy your custom ts-app and ts-web Docker images.