-
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 (#215)
- Loading branch information
Showing
9 changed files
with
445 additions
and
65 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
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
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,22 @@ | ||
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 && \ | ||
ln -s /opt/prometheus-pve-exporter/bin/pve_exporter /usr/bin/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,32 @@ | ||
[build-system] | ||
requires = ["setuptools", "setuptools-scm"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "prometheus-pve-exporter" | ||
version = "3.1.0" | ||
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"] | ||
|
||
[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"] } |
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,2 @@ | ||
pylint==2.12.2 | ||
pyflakes |
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 |
Large diffs are not rendered by default.
Oops, something went wrong.
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,38 +1,3 @@ | ||
from setuptools import find_packages | ||
from setuptools import setup | ||
|
||
setup( | ||
name="prometheus-pve-exporter", | ||
version="3.1.0", | ||
author="Lorenz Schori", | ||
author_email="[email protected]", | ||
description=("Proxmox VE exporter for the Prometheus monitoring system."), | ||
long_description=open('README.rst').read(), | ||
license="Apache Software License 2.0", | ||
keywords="prometheus exporter network monitoring proxmox", | ||
url="https://github.com/prometheus-pve/prometheus-pve-exporter", | ||
package_dir={"": "src"}, | ||
packages=find_packages('src'), | ||
entry_points={ | ||
'console_scripts': [ | ||
'pve_exporter=pve_exporter.cli:main', | ||
], | ||
}, | ||
python_requires=">=3.9", | ||
install_requires=[ | ||
"prometheus_client>=0.0.11", | ||
"proxmoxer", | ||
"pyyaml", | ||
"requests", | ||
'Werkzeug', | ||
'gunicorn', | ||
], | ||
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", | ||
], | ||
) | ||
setup() |
This file was deleted.
Oops, something went wrong.