diff --git a/docs/continuous-integration/use-ci/build-and-upload-artifacts/build-multi-arch.md b/docs/continuous-integration/use-ci/build-and-upload-artifacts/build-multi-arch.md index 606cbce6b78..1e9371aefe1 100644 --- a/docs/continuous-integration/use-ci/build-and-upload-artifacts/build-multi-arch.md +++ b/docs/continuous-integration/use-ci/build-and-upload-artifacts/build-multi-arch.md @@ -4,6 +4,49 @@ description: You can build multi-architecture images in a CI pipeline. sidebar_position: 21 --- +This document covers methods for building multi architecture images in Harness with or without [Docker layer caching (DLC)](/docs/continuous-integration/use-ci/caching-ci-data/docker-layer-caching). + +## With DLC + +:::info 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](mailto:support@harness.io). + +::: + +1. Open your [Build and Push an image to Docker Registry](/docs/continuous-integration/use-ci/build-and-upload-artifacts/build-and-push/build-and-push-to-docker-registry/) step. +2. Select `Enable Docker Layer caching`. To learn more, go to [Docker layer caching](/docs/continuous-integration/use-ci/caching-ci-data/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 + +:::info 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](mailto:support@harness.io). + +::: + +1. Open your [Build and Push an image to Docker Registry](/docs/continuous-integration/use-ci/build-and-upload-artifacts/build-and-push/build-and-push-to-docker-registry/) step. +2. Open the **Optional Configuration** dropdown at the bottom of the step. +3. Add two variables under **Environment Variables**. +4. Enter `PLUGIN_PLATFORM` for your first **Key**. +5. Then, enter your architectures as a comma separated list as your **Value**. For example, `linux/amd64,linux/arm64`. +6. Enter `PLUGIN_BUILDER_DRIVER` for your second variable's **Key**. +7. Then, enter `docker-container` for your second variable's **Value**. + +## Deprecated Methods +
+Deprecated method of building multi-arch images on Kubernetes infrastructure + +:::info + +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: @@ -146,3 +189,5 @@ pipeline: limits: memory: 100M ``` + +
\ No newline at end of file