Based on https://github.com/jimsalterjrs/sanoid/blob/master/INSTALL.md#debianubuntu
- build, test and extract .deb:
docker build -o . .
- build from master, test and extract .deb:
docker build --build-arg sanoid_rev='master' -o . .
*.deb |
Based on https://github.com/jimsalterjrs/sanoid/blob/master/INSTALL.md#debianubuntu
docker build -o . .
docker build --build-arg sanoid_rev='master' -o . .
# https://gist.github.com/andras-tim/aaf7716bc3fd095c5f4a1296fff1be98 | |
ARG sanoid_rev='v2.1.0' | |
FROM ubuntu:jammy AS requirements | |
ENV DEBIAN_FRONTEND='noninteractive' | |
ENV TZ='Europe/Budapest' | |
RUN set -xe \ | |
&& apt-get update \ | |
&& ln -fs "/usr/share/zoneinfo/${TZ}" /etc/localtime \ | |
&& apt-get install -y \ | |
build-essential \ | |
debhelper \ | |
git \ | |
libcapture-tiny-perl \ | |
libconfig-inifiles-perl \ | |
lzop \ | |
mbuffer \ | |
pv \ | |
zfsutils-linux \ | |
&& apt-get clean | |
FROM requirements AS build | |
ARG sanoid_rev | |
RUN set -xe \ | |
&& git clone --depth 1 -b "${sanoid_rev}" 'https://github.com/jimsalterjrs/sanoid.git' \ | |
&& cd sanoid \ | |
&& ln -s packages/debian . \ | |
&& dpkg-buildpackage -uc -us \ | |
&& cd .. \ | |
# include revision into the deb name if it is not the same as the package version | |
&& deb_name="$(ls sanoid*.deb)" \ | |
&& if [ "${deb_name}" != "sanoid_${sanoid_rev}_all.deb" ] && [ "${deb_name}" != "sanoid_${sanoid_rev##v}_all.deb" ]; then \ | |
mv -v "${deb_name}" "sanoid-${sanoid_rev}_${deb_name##sanoid_}"; \ | |
fi | |
FROM requirements AS test | |
COPY --from=build sanoid*.deb / | |
RUN set -xe \ | |
&& dpkg -i /sanoid*.deb \ | |
&& sanoid --version | |
FROM scratch AS export | |
ARG sanoid_rev | |
COPY --from=test sanoid*.deb / |