Building a Tomcat container image

When you generate artificats for Tomcat workloads, Migrate to Containers creates a script. You then use this script to build the deployment container image.

Before you begin

This topic assumes that you've already:

Review the artifacts

Review the artifacts before building the deployable container image. Run the following command:

migctl migration get-artifacts my-migration

Migrate to Containers makes a corresponding nested directory according to your migration plan for each of the server images. These nested directories include image artifacts for building and deploying an image. The command above allows you to download the generated container artifacts in this nested directory

Included in each directory you can find multiple artifacts:

  • the file that you can use to build the container image for the Tomcat server
  • the deployment_spec.yaml file that you use to deploy the container image
  • the cloudbuild.yaml file that you can use to rebuild the image later as part of a CI/CD pipeline
  • the volumes.yaml file which contains a breakdown of your migrated data volumes
  • the secrets.yaml file that contains the sensitive data collected by the migration, if requested by the user

    For more information about verifying your migration artifacts, see Step 9: Verify volumes.yaml below.

(Optional) Verify volumes.yaml

One of the artifacts that Migrate to Containers generates upon completion of a migration is the volumes.yaml file.

Your volumes.yaml file contains information about the PVCs, and PVs that data was copied into as part of the data migration. You can choose to use this information to modify the migrated workload. Do this before you deploy workload in order to make the copied data accessible.

The format of the volumes.yaml file is shown in the following:

           deployment pvc name:
               full pvc yaml
               full pvc yaml

For more information about defining a PVC or PV yaml file, see the Kubernetes documentation.

For more information about defining your data volumes, see the Customizing your data migration configuration section.

Build the container image

You can build the container image using or Skaffold. Skaffold allows you to build and deploy in the same command, and is typically easier to use. If you don't want to use Skaffold, you can use

To build using Skaffold, see Build and deploy multiple images using Skaffold.

Build the container image using

  1. Use the file created in the migration artifacts to build the container image for your Tomcat server.

    1. Change to the directory where the generated artifacts for your Tomcat image are.

      For example, to change to the directory for a Tomcat server named latest and an image named app, run the following command:

      cd latest/app
    2. Set your Google Cloud Project ID and image version:

      export PROJECT_ID=my_project VERSION=latest
    3. Run the script to build your container image and upload it to the Container Registry:

      bash ./

Next Steps