diff --git a/APKBUILD b/APKBUILD new file mode 100644 index 0000000..01d9cee --- /dev/null +++ b/APKBUILD @@ -0,0 +1,28 @@ +pkgname=pve-exporter +pkgver="3.1.0" +pkgrel=0 +pkgdesc="Proxmox VE exporter for the Prometheus monitoring system." +url="https://github.com/prometheus-pve/prometheus-pve-exporter" +arch="noarch" +license="Apache Software License 2.0" +depends="python3 py3-proxmoxer" +subpackages="$pkgname-pyc" +options="!check" # no tests + +srcdir="${startdir}/abuild/src" +pkgbasedir="${startdir}/abuild/pkg" +tmpdir="${startdir}/abuild/tmp" + +unpack() { + ln -v -s "$startdir" "$builddir" +} + +build() { + cd "$builddir" + python3 setup.py build +} + +package() { + cd "$builddir" + python3 setup.py install --skip-build --root="$pkgdir" +} diff --git a/Dockerfile b/Dockerfile index c488a10..6d77fb3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,16 +14,31 @@ RUN apk add --no-cache \ python3 FROM base as builder -ADD . /src -WORKDIR /opt -RUN pip3 wheel --no-deps /src proxmoxer==2.0.1 + +RUN apk add --no-cache \ + alpine-sdk + +RUN abuild-keygen -a -n -q && cp /root/.abuild/*.pub /etc/apk/keys/ + +ADD alpine/py3-openssh-wrapper /src/alpine/py3-openssh-wrapper +WORKDIR /src/alpine/py3-openssh-wrapper +RUN abuild -r -F && apk add --no-cache /root/packages/alpine/*/py3-openssh-wrapper-*.apk + +ADD alpine/py3-proxmoxer /src/alpine/py3-proxmoxer +WORKDIR /src/alpine/py3-proxmoxer +RUN abuild -r -F && apk add --no-cache /root/packages/alpine/*/py3-proxmoxer-*.apk + +ADD . /src/alpine/pve-exporter +WORKDIR /src/alpine/pve-exporter +RUN abuild -r -F && apk add --no-cache /root/packages/alpine/*/pve-exporter-*.apk FROM base as runtime -COPY --from=builder /opt /opt +COPY --from=builder /root/.abuild/*.pub /etc/apk/keys/ +COPY --from=builder /root/packages/alpine/ /root/packages/alpine/ -RUN pip3 install --no-cache-dir --no-index /opt/*py3-none-any.whl && \ - rm /opt/*py3-none-any.whl && \ +RUN apk add --no-cache /root/packages/alpine/*/*.apk && \ + rm -rf /root/packages && \ addgroup -S -g 101 prometheus && \ adduser -D -H -S -G prometheus -u 101 prometheus diff --git a/alpine/py3-openssh-wrapper/APKBUILD b/alpine/py3-openssh-wrapper/APKBUILD new file mode 100644 index 0000000..dbfd6ac --- /dev/null +++ b/alpine/py3-openssh-wrapper/APKBUILD @@ -0,0 +1,27 @@ +# Contributor: Patrycja Rosa +# Maintainer: Patrycja Rosa +pkgname=py3-openssh-wrapper +pkgver=0.5_git20130425 +_commit=bbae8f9085ee341ea9f34231c8b716aa0d9b3a49 +pkgrel=2 +pkgdesc="Python wrapper around OpenSSH client" +url="https://github.com/NetAngels/openssh-wrapper" +arch="noarch" +license="BSD" +depends="python3" +subpackages="$pkgname-pyc" +source="https://github.com/NetAngels/openssh-wrapper/archive/$_commit/py3-openssh-wrapper-$pkgver.tar.gz" +builddir="$srcdir/openssh-wrapper-$_commit" +options="!check" # requires ssh daemon on localhost + +build() { + python3 setup.py build +} + +package() { + python3 setup.py install --skip-build --root="$pkgdir" +} + +sha512sums=" +7b41f37aa4051e62efda1014543e395e396b9ce5e5b4a291cc4af6b31331b634818ff040bc385834ac26432b5d83cd6ac1767ecfd89c8902fe1d07a0b725a3e5 py3-openssh-wrapper-0.5_git20130425.tar.gz +" diff --git a/alpine/py3-proxmoxer/APKBUILD b/alpine/py3-proxmoxer/APKBUILD new file mode 100644 index 0000000..fd06bdc --- /dev/null +++ b/alpine/py3-proxmoxer/APKBUILD @@ -0,0 +1,40 @@ +# Contributor: Patrycja Rosa +# Maintainer: Patrycja Rosa +pkgname=py3-proxmoxer +pkgver=2.0.1 +pkgrel=1 +pkgdesc="Python wrapper for Proxmox API v2" +url="https://github.com/proxmoxer/proxmoxer" +arch="noarch" +license="MIT" +depends="python3" +makedepends="py3-setuptools" +checkdepends=" + py3-mock + py3-openssh-wrapper + py3-paramiko + py3-pytest + py3-requests-toolbelt + py3-responses + py3-testfixtures + " +subpackages="$pkgname-pyc" +source="https://github.com/proxmoxer/proxmoxer/archive/$pkgver/proxmoxer-$pkgver.tar.gz" +builddir="$srcdir/proxmoxer-$pkgver" + +build() { + python3 setup.py build +} + +check() { + # current https tests require an ancient version of py3-requests + pytest +} + +package() { + python3 setup.py install --skip-build --root="$pkgdir" +} + +sha512sums=" +74bdf599d85aaf16cf2802a728b83c18d572ea0df46c743e221ba0019c3fb9163f5acc0288cfd0d613d3c1b5691866e77b9e6448591dfc5faacc4226eab8344e proxmoxer-2.0.1.tar.gz +"