For the complete documentation index, see llms.txt. This page is also available as Markdown.

Build multi-architecture images

You can build multi-architecture images in a CI pipeline.

This document covers methods for building multi architecture images in Harness with or without Docker layer caching (DLC).

With DLC

SELF-HOSTED INFRASTRUCTURE

If you're using self-hosted infrastructure, turn on the feature flag CI_ENABLE_DLC_SELF_HOSTED. To enable this flag, contact Harness Support.

  1. Select Enable Docker Layer caching. To learn more, go to Docker layer caching.

  2. Open the Optional Configuration dropdown at the bottom of the step.

  3. Add a variable under Environment Variables.

  4. Enter PLUGIN_PLATFORM for your Key.

  5. Enter your architectures as a comma separated list as your Value. For example, linux/amd64,linux/arm64.

Without DLC

KUBERNETES INFRASTRUCTURE

If you're using Kubernetes infrastructure, turn on the feature flag CI_USE_BUILDX_ON_K8. To enable this flag, contact Harness Support.

  1. Open the Optional Configuration dropdown at the bottom of the step.

  2. Add two variables under Environment Variables.

  3. Enter PLUGIN_PLATFORM for your first Key.

  4. Then, enter your architectures as a comma separated list as your Value. For example, linux/amd64,linux/arm64.

  5. Enter PLUGIN_BUILDER_DRIVER for your second variable's Key.

  6. Then, enter docker-container for your second variable's Value.

Deprecated Methods

Deprecated method of building multi-arch images on Kubernetes infrastructure

The following method for building multi-arch images is not recommended.

To build multi-architecture images in a CI pipeline, use a separate stage to build and push each architecture.

For example, the following pipeline has two stages. The two stages have similar components, but they differ according to the architecture of the image that the stage builds. Each stage has:

  • A variation of a Kubernetes cluster build infrastructure. Notice that each stage uses a different Kubernetes cluster connector (infrastructure.spec.connectorRef) and other settings due to the different architecture requirements.

  • A Run step that prepares the Dockerfile.

  • A Build and Push step that builds and uploads the image. If the images are uploaded to the same repository, use tags to differentiate them, such as 1.0-linux-amd64 and 1.0-linux-arm64.

Last updated

Was this helpful?