Skip to content

Commit

Permalink
release: build multi-arch docker image (#50)
Browse files Browse the repository at this point in the history
* release: build multi-arch docker image

* docker: add entrypoint that mounts debugfs if it's not mounted
  • Loading branch information
Gandem authored Aug 13, 2024
1 parent 63744cd commit 2f1c59f
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,37 @@ jobs:

release:
env:
REGISTRY: ghcr.io
IMAGE_NAME: datadog/otel-profiling-agent
RELEASE_VERSION: ${{ github.ref_name }}
needs: build
name: Release
runs-on: ubuntu-24.04
permissions:
actions: read
contents: write
packages: 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: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
annotations: |
org.opencontainers.image.description=The Datadog OpenTelemetry Profiling Agent is a full-host profiler that collects and sends profiling data to Datadog
org.opencontainers.image.vendor=Datadog
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Create assets
Expand All @@ -35,3 +58,12 @@ jobs:
omitBody: true
draft: true
tag: ${{ env.RELEASE_VERSION }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile.release
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
annotations: ${{ steps.meta.outputs.annotations }}
18 changes: 18 additions & 0 deletions docker/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

RUN apt-get update && \
apt-get install -y --no-install-recommends binutils ca-certificates

COPY docker/entrypoint.sh /entrypoint.sh
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/*

ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/local/bin/otel-profiling-agent"]
11 changes: 11 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#! /usr/bin/env sh
set -e

# Wrapper to ensure debugfs is mounted

# Mount debugfs if not already mounted
if [ ! -d /sys/kernel/debug/tracing ]; then
mount -t debugfs none /sys/kernel/debug
fi

exec "$@"

0 comments on commit 2f1c59f

Please sign in to comment.