1
1
# To build one auto-instrumentation image for Python, please:
2
- # - Ensure the packages are installed in the `/autoinstrumentation` directory. This is required as when instrumenting the pod,
3
- # one init container will be created to copy all the content in `/autoinstrumentation` directory to your app's container. Then
2
+ # - Ensure the packages are installed in the `/autoinstrumentation,{-musl} ` directory. This is required as when instrumenting the pod,
3
+ # one init container will be created to copy all the content in `/autoinstrumentation{,-musl} ` directory to your app's container. Then
4
4
# update the `PYTHONPATH` environment variable accordingly. To achieve this, you can mimic the one in `autoinstrumentation/python/Dockerfile`
5
5
# by using multi-stage builds. In the first stage, install all the required packages in one custom directory with `pip install --target`.
6
- # Then in the second stage, copy the directory to `/autoinstrumentation`.
6
+ # Then in the second stage, copy the directory to `/autoinstrumentation{,-musl} `.
7
7
# - Ensure you have `opentelemetry-distro` and `opentelemetry-instrumentation` or your customized alternatives installed.
8
8
# Those two packages are essential to Python auto-instrumentation.
9
- # - Grant the necessary access to `/autoinstrumentation` directory. `chmod -R go+r /autoinstrumentation`
9
+ # - Grant the necessary access to `/autoinstrumentation{,-musl} ` directory. `chmod -R go+r /autoinstrumentation`
10
10
# - For auto-instrumentation by container injection, the Linux command cp is
11
11
# used and must be availabe in the image.
12
12
FROM python:3.11 AS build
@@ -17,8 +17,19 @@ ADD requirements.txt .
17
17
18
18
RUN mkdir workspace && pip install --target workspace -r requirements.txt
19
19
20
+ FROM python:3.11-alpine AS build-musl
21
+
22
+ WORKDIR /operator-build
23
+
24
+ ADD requirements.txt .
25
+
26
+ RUN apk add gcc python3-dev musl-dev linux-headers
27
+ RUN mkdir workspace && pip install --target workspace -r requirements.txt
28
+
20
29
FROM busybox
21
30
22
31
COPY --from=build /operator-build/workspace /autoinstrumentation
32
+ COPY --from=build-musl /operator-build/workspace /autoinstrumentation-musl
23
33
24
34
RUN chmod -R go+r /autoinstrumentation
35
+ RUN chmod -R go+r /autoinstrumentation-musl
0 commit comments