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 eb9ae03
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 0 deletions.
33 changes: 33 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,20 @@ jobs:
prerelease: true
draft: false
tag: ${{ env.RELEASE_VERSION }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.release
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/datadog/otel-profiling-agent:${{ env.RELEASE_VERSION }}
annotations: |
index,manifest:org.opencontainers.image.source=https://github.com/DataDog/otel-profiling-agent
index,manifest:org.opencontainers.image.revision=${{ github.sha }}
index,manifest:org.opencontainers.image.vendor=Datadog
index,manifest:org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
index,manifest:org.opencontainers.image.ref.name=${{ (github.event_name != 'pull_request' && github.ref_name) || github.head_ref }}
index,manifest:org.opencontainers.image.title=Datadog OpenTelemetry Profiling Agent
index,manifest:org.opencontainers.image.description=The Datadog OpenTelemetry Profiling Agent is a full-host profiler that collects and sends profiling data to Datadog
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,27 @@ jobs:

release:
env:
REGISTRY: ghcr.io
RELEASE_VERSION: ${{ github.ref_name }}
needs: build
name: Release
runs-on: ubuntu-24.04
permissions:
actions: read
contents: write
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: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create assets
Expand All @@ -35,3 +48,19 @@ jobs:
omitBody: true
draft: true
tag: ${{ env.RELEASE_VERSION }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.release
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/datadog/otel-profiling-agent:${{ env.RELEASE_VERSION }},ghcr.io/datadog/otel-profiling-agent:latest
annotations: |
index,manifest:org.opencontainers.image.source=https://github.com/DataDog/otel-profiling-agent
index,manifest:org.opencontainers.image.revision=${{ github.sha }}
index,manifest:org.opencontainers.image.vendor=Datadog
index,manifest:org.opencontainers.image.version=${{ env.RELEASE_VERSION }}
index,manifest:org.opencontainers.image.ref.name=${{ github.ref_name }}
index,manifest:org.opencontainers.image.title=Datadog OpenTelemetry Profiling Agent
index,manifest:org.opencontainers.image.description=The Datadog OpenTelemetry Profiling Agent is a full-host profiler that collects and sends profiling data to Datadog
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 eb9ae03

Please sign in to comment.