Skip to content

Commit 0d331f4

Browse files
authored
operator: add musl based autoinstrumentation to docker image (#162)
* operator: add musl based autoinstrumentation in the Docker image * operator: build the docker image on ci
1 parent 5f89a4d commit 0d331f4

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,22 @@ jobs:
3939
- run: pip install pip-licenses
4040
- run: pip-licenses
4141

42-
operator-requirements-installable:
42+
operator-image-buildable:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v4
4646
- uses: ./.github/actions/env-install
47-
- run: pip install .
48-
- run: pip install -r operator/requirements.txt
47+
- run: pip install build
48+
- run: python -m build
49+
- name: Set up Docker Buildx
50+
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
51+
- name: Log in to the Elastic Container registry
52+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
53+
with:
54+
registry: ${{ secrets.ELASTIC_DOCKER_REGISTRY }}
55+
username: ${{ secrets.ELASTIC_DOCKER_USERNAME }}
56+
password: ${{ secrets.ELASTIC_DOCKER_PASSWORD }}
57+
- run: docker build -f operator/Dockerfile --build-arg DISTRO_DIR=./dist .
4958

5059
test:
5160
runs-on: ubuntu-latest

operator/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,26 @@ RUN mkdir workspace
1616

1717
RUN pip install --no-cache-dir --target workspace /opt/distro/*.whl -r requirements.txt
1818

19+
FROM python:3.12-alpine AS build-musl
20+
21+
ARG DISTRO_DIR
22+
23+
COPY ${DISTRO_DIR} /opt/distro
24+
25+
WORKDIR /operator-build
26+
27+
ADD operator/requirements.txt .
28+
29+
RUN mkdir workspace
30+
31+
RUN apk add gcc python3-dev musl-dev linux-headers
32+
33+
RUN pip install --no-cache-dir --target workspace /opt/distro/*.whl -r requirements.txt
34+
1935
FROM docker.elastic.co/wolfi/chainguard-base:latest@sha256:90888b190da54062f67f3fef1372eb0ae7d81ea55f5a1f56d748b13e4853d984
2036

2137
COPY --from=build /operator-build/workspace /autoinstrumentation
38+
COPY --from=build-musl /operator-build/workspace /autoinstrumentation-musl
2239

2340
RUN chmod -R go+r /autoinstrumentation
41+
RUN chmod -R go+r /autoinstrumentation-musl

0 commit comments

Comments
 (0)