Building a Tomcat container image
When you generate artificats for Tomcat workloads, Migrate to Containers
build.sh 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:
build.shfile that you can use to build the container image for the Tomcat server
deployment_spec.yamlfile that you use to deploy the container image
cloudbuild.yamlfile that you can use to rebuild the image later as part of a CI/CD pipeline
volumes.yamlfile which contains a breakdown of your migrated data volumes
secrets.yamlfile 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
One of the artifacts that Migrate to Containers generates upon
completion of a migration is the
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:
volumes: deployment pvc name: pvc: full pvc yaml pv: full pvc yaml
For more information about defining a PVC or PV
yaml file, see the
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 build.sh 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 build.sh.
To build using Skaffold, see Build and deploy multiple images using Skaffold.
Build the container image using
build.shfile created in the migration artifacts to build the container image for your Tomcat server.
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
latestand an image named
app, run the following command:
Set your Google Cloud Project ID and image version:
export PROJECT_ID=my_project VERSION=latest
build.shscript to build your container image and upload it to the Container Registry: