-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (31 loc) · 1016 Bytes
/
Dockerfile
File metadata and controls
43 lines (31 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM python:3.10.12 as base
ENV ENVIRONMENT=prod \
TESTING=0 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_DEFAULT_TIMEOUT=100 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/opt/pysetup" \
VENV_PATH="/opt/pysetup/.venv" \
DIRPATH="/otel-issue-example"
ENV PATH="$POETRY_HOME/bin:$VENV_PATH/bin:$PATH"
FROM base as builder
ENV POETRY_VERSION="1.3.2"
RUN pip install poetry=="$POETRY_VERSION"
WORKDIR $PYSETUP_PATH
COPY ./pyproject.toml ./
RUN poetry install --no-root --no-ansi --no-interaction
RUN opentelemetry-bootstrap --action=install
FROM base as final
WORKDIR $DIRPATH
COPY --from=builder $VENV_PATH $VENV_PATH
COPY main.py .
EXPOSE 8080
ENV OTEL_METRICS_EXPORTER=none \
OTEL_TRACES_EXPORTER=none \
OTEL_PYTHON_LOG_CORRELATION=true \
OTEL_SERVICE_NAME=log-issue-repro
CMD opentelemetry-instrument uvicorn main:app --host 0.0.0.0 --port 8080