50 lines
1.1 KiB
Docker
50 lines
1.1 KiB
Docker
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"]
|