Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and install apk in container build spec #214

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
28 changes: 28 additions & 0 deletions APKBUILD
Original file line number Diff line number Diff line change
@@ -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"
}
27 changes: 21 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
27 changes: 27 additions & 0 deletions alpine/py3-openssh-wrapper/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Contributor: Patrycja Rosa <[email protected]>
# Maintainer: Patrycja Rosa <[email protected]>
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
"
40 changes: 40 additions & 0 deletions alpine/py3-proxmoxer/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Contributor: Patrycja Rosa <[email protected]>
# Maintainer: Patrycja Rosa <[email protected]>
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
"