diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml index 036c4977..8ff42125 100644 --- a/.github/workflows/build-and-release.yaml +++ b/.github/workflows/build-and-release.yaml @@ -40,6 +40,7 @@ on: env: BENV_IMAGE: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:buil-env-buildx + BENV_IMAGE_ARM: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:build-env-arm64 DOCKER_REGISTRY: docker.io DOCKER_NAMESPACE: solarwinds IMAGE_PREFIX: "opentelemetry-ebpf-" @@ -93,7 +94,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Fetch build environment run: | - docker pull $BENV_IMAGE + docker pull $BENV_IMAGE $BENV_IMAGE_ARM - name: Build artifacts run: | mkdir -p $GITHUB_WORKSPACE/out @@ -102,9 +103,16 @@ jobs: --mount "type=bind,source=$GITHUB_WORKSPACE/src,destination=/root/src,readonly" \ --mount "type=bind,source=$GITHUB_WORKSPACE/out,destination=/root/out" \ --env EBPF_NET_SRC_ROOT=/root/src \ - --env ENABLE_ARM64_BUILD=TRUE \ $BENV_IMAGE \ ./build.sh docker + docker run -t --rm \ + --mount "type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock" \ + --mount "type=bind,source=$GITHUB_WORKSPACE/src,destination=/root/src,readonly" \ + --mount "type=bind,source=$GITHUB_WORKSPACE/out,destination=/root/out" \ + --env EBPF_NET_SRC_ROOT=/root/src \ + --env ENABLE_ARM64_BUILD=TRUE \ + $BENV_IMAGE_ARM \ + ./build.sh docker - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/.github/workflows/build-and-test.yaml b/.github/workflows/build-and-test.yaml index 72274b24..b07ee3e5 100644 --- a/.github/workflows/build-and-test.yaml +++ b/.github/workflows/build-and-test.yaml @@ -7,7 +7,8 @@ on: pull_request: env: - BENV_IMAGE: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:buil-env-buildx + BENV_IMAGE_AMD: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:buil-env-buildx + BENV_IMAGE_ARM: public.ecr.aws/u7d6c4a3/solarwinds-opentelemetry-network:build-env-arm64 concurrency: group: build-and-test-${{ github.event.pull_request_number || github.ref }} diff --git a/cmake/docker-utils.cmake b/cmake/docker-utils.cmake index 6c35504d..9394bce6 100644 --- a/cmake/docker-utils.cmake +++ b/cmake/docker-utils.cmake @@ -156,14 +156,7 @@ function(build_custom_docker_image IMAGE_NAME) if (RUN_DOCKER_COMMANDS) - add_custom_command( - TARGET - "${IMAGE_NAME}-docker" - WORKING_DIRECTORY - "${out_path}" - COMMAND - docker buildx build --platform linux/amd64 -t "${IMAGE_NAME}" ${DOCKER_ARGS} . - ) + if (ENABLE_ARM64_BUILD) add_custom_command( TARGET @@ -173,6 +166,15 @@ function(build_custom_docker_image IMAGE_NAME) COMMAND docker buildx build --platform linux/arm64 -t "${IMAGE_NAME}-arm64" ${DOCKER_ARGS} . ) + else() + add_custom_command( + TARGET + "${IMAGE_NAME}-docker" + WORKING_DIRECTORY + "${out_path}" + COMMAND + docker buildx build --platform linux/amd64 -t "${IMAGE_NAME}" ${DOCKER_ARGS} . + ) endif() endif()