Debian Codegraph @

Dockerfile

raw
1 # Build dh-virtualenv's Debian package within a container for any platform
2 #
3 # docker build --tag dh-venv-builder --build-arg distro=debian:10 .
4 # docker build --tag dh-venv-builder --build-arg distro=ubuntu:bionic .
5 #
6 # mkdir -p dist && command docker run --rm dh-venv-builder tar -C ../dpkg -c . | tar -C dist -xv
7 #
8 # Add '--build-arg opts=nodoc' to remove dependencies on Sphinx packages not available in older releases.
9
10 ARG distro="debian:stable"
11 ARG opts=""
12
13 FROM ${distro} AS dpkg-build
14 ENV DEB_BUILD_OPTIONS=${opts}
15 RUN apt-get update -qq -o Acquire::Languages=none \
16 && env DEBIAN_FRONTEND=noninteractive apt-get install \
17 -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \
18 build-essential debhelper devscripts equivs lsb-release libparse-debianchangelog-perl \
19 python3 python3-setuptools python3-pip python3-dev \
20 python3-sphinx python3-mock dh-exec dh-python python3-sphinx-rtd-theme \
21 && if test "$(lsb_release -cs)" = 'bionic' ; then \
22 apt-get install -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \
23 -t bionic-backports debhelper; fi \
24 && apt-get clean && rm -rf "/var/lib/apt/lists"/*
25 WORKDIR /dpkg-build
26 COPY ./ ./
27 # The "chmod" call fixes '-rwxr-xr-x' permission problems you get when running this builder from Windows.
28 RUN sed -i -re "1s/..unstable/~$(lsb_release -cs)) $(lsb_release -cs)/" debian/changelog \
29 && chmod a-x debian/dh-virtualenv.* \
30 && dpkg-buildpackage -us -uc -b && mkdir -p /dpkg && cp -pl /dh-virtualenv[-_]* /dpkg \
31 && dpkg-deb -I /dpkg/dh-virtualenv_*.deb