commit 26a4b16223365d9bacdc41783f0b67cdf548c3de Author: Dustin C. Hatch Date: Sat Jun 8 07:57:46 2024 -0500 Initial commit Although there is a *docker.io/ngosang/restic-exporter* image, for simple tools like this, I prefer to maintain container images myself. This ensures that the images will continue to receive operating system updates, even if the upstream project stagnates. diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..4b67dc2 --- /dev/null +++ b/Containerfile @@ -0,0 +1,49 @@ +FROM git.pyrocufflink.net/containerimages/dch-base AS build + +RUN --mount=type=cache,target=/var/cache \ + microdnf install -y \ + --setopt=install_weak_deps=0 \ + git-core \ + python3-pip \ + python3-wheel \ + && : + +WORKDIR /build + +ARG RESTIC_EXPORTER_VERSION=1.5.0 + +RUN git clone \ + https://github.com/ngosang/restic-exporter.git \ + --depth 1 \ + -b ${RESTIC_EXPORTER_VERSION} \ + && : + +WORKDIR /build/restic-exporter + +RUN python3 -m pip wheel -w ../wheels -r requirements.txt + + +FROM git.pyrocufflink.net/containerimages/dch-base + +RUN --mount=type=cache,target=/var/cache \ + microdnf install -y \ + --setopt=install_weak_deps=0 \ + python3 \ + restic \ + tini \ + && : + +RUN --mount=type=bind,from=build,src=/build,target=/build \ + python3 -m venv /app \ + && pythonpath=$(/app/bin/python -Esc 'from sysconfig import *;print(get_path("purelib"))') \ + && /app/bin/python -m pip install \ + --find-links /build/wheels \ + --no-index \ + --requirement /build/restic-exporter/requirements.txt \ + && cp /build/restic-exporter/restic-exporter.py \ + "${pythonpath}"/restic_exporter.py \ + && : + +USER 8001:8001 + +ENTRYPOINT ["tini", "/app/bin/python", "--", "-m", "restic_exporter"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..c187df7 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1 @@ +buildContainerImage2()