-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
45 lines (32 loc) · 1.21 KB
/
Dockerfile
File metadata and controls
45 lines (32 loc) · 1.21 KB
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
44
45
FROM python:3.13 AS builder
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
POETRY_VERSION=1.8.5 \
POETRY_HOME=/opt/poetry \
POETRY_NO_INTERACTION=1
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get install -y --no-install-recommends curl \
&& rm -rf /var/lib/apt/lists/* \
&& curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="$POETRY_HOME/bin:$PATH"
WORKDIR /build
COPY pyproject.toml poetry.lock ./
RUN poetry export --without dev --without-hashes --format requirements.txt --output requirements.txt \
&& pip install --no-cache-dir --target=/install --requirement requirements.txt
FROM gcr.io/distroless/python3-debian13:nonroot
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONPATH=/code/site-packages \
DEPLOYMENT_TYPE=HA \
CONFIG_FILE=/code/ha_config.yaml
WORKDIR /code
COPY --from=builder --chown=nonroot:nonroot /install /code/site-packages
COPY --chown=nonroot:nonroot \
mg_exporter.py \
standalone_main.py standalone_model.py standalone_config.yaml \
ha_main.py ha_model.py ha_config.yaml \
./
COPY --chown=nonroot:nonroot metrics /code/metrics
USER nonroot:nonroot
ENTRYPOINT ["python3", "/code/mg_exporter.py"]