Skip to content

Commit

Permalink
release: build multi-arch docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Gandem committed Aug 12, 2024
1 parent 63744cd commit a08769d
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,28 @@ jobs:

publish:
env:
REGISTRY: ghcr.io
RELEASE_VERSION: ${{ github.event_name == 'pull_request' && 'dev-test' || 'dev' }}
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'publish-dev-test') )}}
name: Publish pre-release
needs: [build]
runs-on: ubuntu-24.04
permissions:
packages: write
attestations: write
contents: write
id-token: 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: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create assets
Expand Down Expand Up @@ -305,3 +321,26 @@ jobs:
prerelease: true
draft: false
tag: ${{ env.RELEASE_VERSION }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.release
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/datadog/otel-profiling-agent:${{ env.RELEASE_VERSION }}
labels: |
org.opencontainers.image.source=https://github.com/DataDog/otel-profiling-agent
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.vendor=Datadog
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.title=Datadog OpenTelemetry Profiling Agent
org.opencontainers.image.description=The Datadog OpenTelemetry Profiling Agent is a full-host profiler that collects and sends profiling data to Datadog.
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/otel-profiling-agent
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
18 changes: 18 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -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 sudo

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"]

0 comments on commit a08769d

Please sign in to comment.