-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use pyproject.toml, pip-compile and venv to build container image
- Loading branch information
Showing
6 changed files
with
427 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,21 @@ | ||
FROM alpine:3.18.5 as base | ||
FROM alpine:3.18.5 | ||
RUN apk update && apk upgrade | ||
|
||
RUN apk add --no-cache \ | ||
ca-certificates \ | ||
py3-gunicorn \ | ||
py3-paramiko \ | ||
py3-pip \ | ||
py3-prometheus-client \ | ||
py3-requests \ | ||
py3-werkzeug \ | ||
py3-wheel \ | ||
py3-yaml \ | ||
python3 | ||
|
||
FROM base as builder | ||
ADD . /src | ||
WORKDIR /opt | ||
RUN pip3 wheel --no-deps /src proxmoxer==2.0.1 | ||
ADD . /src/prometheus-pve-exporter | ||
RUN python3 -m venv /opt/prometheus-pve-exporter && \ | ||
/opt/prometheus-pve-exporter/bin/pip install -r /src/prometheus-pve-exporter/requirements.txt && \ | ||
/opt/prometheus-pve-exporter/bin/pip install /src/prometheus-pve-exporter && \ | ||
rm -rf /src/prometheus-pve-exporter /root/.cache | ||
|
||
FROM base as runtime | ||
|
||
COPY --from=builder /opt /opt | ||
|
||
RUN pip3 install --no-cache-dir --no-index /opt/*py3-none-any.whl && \ | ||
rm /opt/*py3-none-any.whl && \ | ||
addgroup -S -g 101 prometheus && \ | ||
RUN addgroup -S -g 101 prometheus && \ | ||
adduser -D -H -S -G prometheus -u 101 prometheus | ||
|
||
USER prometheus | ||
|
||
EXPOSE 9221 | ||
|
||
ENTRYPOINT [ "/usr/bin/pve_exporter" ] | ||
ENTRYPOINT [ "/opt/prometheus-pve-exporter/bin/pve_exporter" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[build-system] | ||
requires = ["setuptools", "setuptools-scm"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "prometheus-pve-exporter" | ||
authors = [ | ||
{name = "Lorenz Schori", email = "[email protected]"}, | ||
] | ||
description="Proxmox VE exporter for the Prometheus monitoring system." | ||
requires-python = ">=3.9" | ||
keywords = ["prometheus", "exporter", "network", "monitoring", "proxmox"] | ||
license = {text = "Apache-2.0"} | ||
classifiers = [ | ||
"Development Status :: 3 - Alpha", | ||
"Intended Audience :: Information Technology", | ||
"Intended Audience :: System Administrators", | ||
"Topic :: System :: Monitoring", | ||
"Topic :: System :: Networking :: Monitoring", | ||
"License :: OSI Approved :: Apache Software License", | ||
] | ||
dynamic = ["dependencies", "optional-dependencies", "readme", "version"] | ||
|
||
[project.urls] | ||
Homepage = "https://github.com/prometheus-pve/prometheus-pve-exporter" | ||
|
||
[project.scripts] | ||
pve_exporter = "pve_exporter.cli:main" | ||
|
||
[tool.setuptools.dynamic] | ||
dependencies = { file = ["requirements.in"] } | ||
optional-dependencies.test = { file = ["requirements-test.txt"] } | ||
readme = {file = ["README.rst"]} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
prometheus_client>=0.0.11 | ||
proxmoxer | ||
pyyaml | ||
requests | ||
Werkzeug | ||
gunicorn | ||
paramiko |
Oops, something went wrong.