Skip to Content

Prepare Multi-Tenant Applications for Deployment with CAP Operator

This tutorial shows you how to prepare your multi-tenant application for deployment in SAP BTP, Kyma runtime using the CAP Operator.
You will learn
  • How to build container images for your multi-tenant application and push them to a container registry.
anirudhprasad-sapAnirudh PrasadApril 1, 2026
Created by
anirudhprasad-sap
March 27, 2026
Contributors
Pavan-SAP
anirudhprasad-sap

Prerequisites

  • Step 1

    Clone the application from the Incident Management Application GitHub Repository. For e.g. using:

    bash
    Copy
    git clone https://github.com/cap-js/incidents-app.git -b cap-operator-tutorials
    

    This is a multi-tenant SAP Cloud Application Programming Model (CAP) application. It utilizes the application router for routing, SAP Authorization and Trust Management service (XSUAA), and SAP HANA Cloud as the database. The front end is built with SAP Fiori and deployed to the HTML5 Application Repository.

    Open a command-line window in the folder where your application holds incidents-app and run the following command to open the project in Visual Studio (VS) Code:

    bash
    Copy
    code .
    
  • Step 2

    Make sure you’re logged in to your container registry. In case if you don’t have access to a container registry, you can make use of the Docker Registry Community Module from Kyma.

    If you’re using a device with a non-x86 processor (for example, MacBook M1/M2), you need to instruct Docker to use x86 images by setting the DOCKER_DEFAULT_PLATFORM environment variable using the command export DOCKER_DEFAULT_PLATFORM=linux/amd64. Check the environment variables for more information.

    Make sure to replace <your-container-registry> with the link to your container registry and keep in mind that <image version> is a string.

    Looking for your Docker server URL?

    The Docker server URL is the same as the path used for Docker login, so you can quickly check it by running the following command in your terminal:

    json
    Copy
    cat ~/.docker/config.json
    

    In case you’re using Docker Hub as your container registry, replace the placeholder <your-container-registry> with your Docker Hub user ID.

    Build the CAP Node.js and the MTXS sidecar image

    1. In VS Code, choose TerminalNew Terminal and run the following command:

      bash
      Copy
      npm install
      

      This command installs the required dependencies and updates the package-lock.json file of your project.

    2. Create the productive CAP build for your application:

      bash
      Copy
      npx cds build --production
      

      The CAP build writes to the gen/srv folder.

    3. Build the CAP Node.js image:

      bash
      Copy
      pack build <your-container-registry>/incident-management-srv:<image-version> \
          --path gen/srv \
          --builder paketobuildpacks/builder-jammy-base \
          --publish
      

      The pack CLI builds the image that contains the build result in the gen/srv folder and the required npm packages by using the Cloud Native Buildpack for Node.js provided by Paketo.

    4. Build the MTXS sidecar image:

      bash
      Copy
      pack build <your-container-registry>/incident-management-mtxs-sidecar:<image-version> \
          --path gen/mtx/sidecar \
          --builder paketobuildpacks/builder-jammy-base \
          --publish
      

      IMPORTANT: The project.toml file in the gen/mtx/sidecar folder is copied automatically from the mtxs/sidecar folder during the build. This file exposes the node process inside the container so that CAP Operator can trigger tenant operations using the MTXS CLIs.

    Build the application router image

    1. In the VS Code terminal, navigate to the app/router folder and run the following command:

      bash
      Copy
      npm install
      
    2. In the VS Code terminal, navigate back to the root folder of your project:

      bash
      Copy
      cd ../..
      
    3. Build the application router image:

      bash
      Copy
      pack build <your-container-registry>/incident-management-approuter:<image-version> \
          --path app/router \
      	--buildpack paketo-buildpacks/nodejs \
      	--builder paketobuildpacks/builder-jammy-base \
      	--env BP_NODE_RUN_SCRIPTS="" \
      	--publish
      

    Build the HTML5 deployer image

    1. In the VS Code terminal, navigate to the ui-resources folder and run the following command:

      bash
      Copy
      npm install && npm run package
      

      This command builds and copies the archive nsincidents.zip inside the ui-resources/resources folder.

    2. In the VS Code terminal, navigate back to the root folder of your project:

      bash
      Copy
      cd ..
      
    3. Build the UI deployer image:

      bash
      Copy
      pack build <your-container-registry>/incident-management-html5-deployer:<image-version> \
          --path ui-resources \
          --builder paketobuildpacks/builder-jammy-base \
          --publish
      
Back to top