From 9809eaaed16fe6e24b1a419f50fd3f3237f50e8a Mon Sep 17 00:00:00 2001 From: Nayef Ghattas Date: Mon, 12 Aug 2024 10:57:25 +0000 Subject: [PATCH] release: build multi-arch docker image --- .github/workflows/build.yml | 18 ++++++++++++++++++ Dockerfile.release | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 Dockerfile.release diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e98ecf..22f9006 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -267,9 +267,24 @@ jobs: name: Publish pre-release needs: [build] runs-on: ubuntu-24.04 + permissions: + packages: write + attestations: write steps: + - name: Check out + uses: actions/checkout@v4 + - name: Setup buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Download artifacts uses: actions/download-artifact@v4 + - name: Display structure of downloaded files + run: ls -R - name: Create assets run: | tar czf otel-profiling-agent-${RELEASE_VERSION}-aarch64.tar.gz -C agent-aarch64 . @@ -305,3 +320,6 @@ jobs: prerelease: true draft: false tag: ${{ env.RELEASE_VERSION }} + - name: Build and push container image + run: | + docker buildx build --push -f Dockerfile.release --platform linux/amd64,linux/arm64 -t ghcr.io/datadog/otel-profiling-agent:${{ env.RELEASE_VERSION }} . diff --git a/Dockerfile.release b/Dockerfile.release new file mode 100644 index 0000000..93ba34d --- /dev/null +++ b/Dockerfile.release @@ -0,0 +1,18 @@ +# syntax=docker.io/docker/dockerfile:1.7-labs +FROM ubuntu:24.04 + +USER root + +RUN apt-get update && \ + apt-get install -y --no-install-recommends binutils curl sudo ca-certificates + +COPY --parents agent-** /tmp/ + +RUN mv /tmp/agent-$(uname -p)/otel-profiling-agent /usr/local/bin/otel-profiling-agent \ + && chmod +x /usr/local/bin/otel-profiling-agent \ + && rm -rf /tmp/agent* + +RUN apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +CMD ["/bin/sh", "-c", "sudo -E /usr/local/bin/otel-profiling-agent"]