1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23FROM python:3.11-slim
WORKDIR /app
# Install OpenTelemetry packages (with version pinning for reproducibility)
RUN pip install --no-cache-dir \
opentelemetry-api==1.21.0 \
opentelemetry-sdk==1.21.0 \
opentelemetry-exporter-otlp-proto-grpc==1.21.0 \
opentelemetry-instrumentation==0.42b0
# Copy the trace generation script
COPY test-traces.py .
# Set environment variables for OpenTelemetry
ENV OTEL_SERVICE_NAME=sample-app
ENV OTEL_SERVICE_VERSION=1.0.0
ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
# Run the trace generator
CMD ["python", "test-traces.py"]