A .dockerignore => .dockerignore +3 -0
@@ 0,0 1,3 @@
+.git
+.gitignore
+dist
A Dockerfile => Dockerfile +42 -0
@@ 0,0 1,42 @@
+ARG DIST_ID="ubuntu"
+ARG CODENAME="jammy"
+ARG EMAIL
+ARG PKG
+ARG VER
+
+FROM ${DIST_ID}:${CODENAME} as build
+
+ARG PKG
+ARG VER
+
+ENV EMAIL "${EMAIL}"
+
+ENV LC_ALL C
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN if grep -q '^# deb-src ' /etc/apt/sources.list; then \
+ sed -i 's/^# deb-src /deb-src /' /etc/apt/sources.list; \
+ else \
+ grep '^deb ' /etc/apt/sources.list | sed 's/^deb/deb-src/' >> /etc/apt/sources.list; \
+ fi
+
+RUN apt-get update -qq && apt-get install -yqq --no-install-recommends \
+ devscripts \
+ build-essential \
+ tar \
+ fakeroot
+
+RUN echo ${PKG}
+RUN apt-get build-dep -y ${PKG} && apt-get source --download-only ${PKG}
+
+#RUN sed -i -r -e "1s/(UNRELEASED|unstable|jessie|stretch|xenial|bionic)/$(lsb_release -cs)/g" debian/changelog
+COPY . /src
+RUN tar xf ${PKG}*.debian.* -C /src
+WORKDIR /src
+
+RUN dch -v "${VER}" "Bump version"
+
+RUN rm -rf /dist && dpkg-buildpackage -rfakeroot -us -uc -b && mkdir /dist && mv ../${PKG}[-_]*.deb /dist
+
+FROM scratch as dist
+COPY --from=build /dist /
A build => build +14 -0
@@ 0,0 1,14 @@
+#!/bin/sh
+#
+PKG="${1:?PACKAGE}"
+VER="${2:?VERSION}"
+
+rm -rf ./dist
+mkdir -p ./dist
+
+DOCKER_BUILDKIT=1 docker build --progress=plain \
+ -t "${PKG}" \
+ --build-arg EMAIL "$(git config user.email)" \
+ --build-arg PKG="${PKG}" \
+ --build-arg VER="${VER}" \
+ --output type=local,dest=./dist .