summary refs log tree commit diff
path: root/docker/build_debian_packages.sh
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2018-12-20 11:35:23 +0000
committerRichard van der Hoff <richard@matrix.org>2018-12-20 11:35:23 +0000
commitd3c9c562c60133a2263b36376aa854064630589d (patch)
tree18d0efeecdbc24f33367f87a2a86aa90f854d3ec /docker/build_debian_packages.sh
parentAdd 'sandbox' to CSP for media repo (#4284) (diff)
parentDebian packaging via dh_virtualenv (#4285) (diff)
downloadsynapse-d3c9c562c60133a2263b36376aa854064630589d.tar.xz
Debian packaging via dh_virtualenv
Diffstat (limited to 'docker/build_debian_packages.sh')
-rwxr-xr-xdocker/build_debian_packages.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/docker/build_debian_packages.sh b/docker/build_debian_packages.sh
new file mode 100755
index 0000000000..eafed4ac41
--- /dev/null
+++ b/docker/build_debian_packages.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+# Build the Debian packages using Docker images.
+#
+# This script builds the Docker images and then executes them sequentially, each
+# one building a Debian package for the targeted operating system. It is
+# designed to be a "single command" to produce all the images.
+#
+# By default, builds for all known distributions, but a list of distributions
+# can be passed on the commandline for debugging.
+
+set -ex
+
+cd `dirname $0`
+
+if [ $# -lt 1 ]; then
+    DISTS=(debian:stretch debian:sid ubuntu:xenial ubuntu:bionic ubuntu:cosmic)
+else
+    DISTS=("$@")
+fi
+
+# Make the dir where the debs will live.
+#
+# Note that we deliberately put this outside the source tree, otherwise we tend
+# to get source packages which are full of debs. (We could hack around that
+# with more magic in the build_debian.sh script, but that doesn't solve the
+# problem for natively-run dpkg-buildpakage).
+
+mkdir -p ../../debs
+
+# Build each OS image;
+for i in "${DISTS[@]}"; do
+    TAG=$(echo ${i} | cut -d ":" -f 2)
+    docker build --tag dh-venv-builder:${TAG} --build-arg distro=${i} -f Dockerfile-dhvirtualenv .
+    docker run -it --rm --volume=$(pwd)/../\:/synapse/source:ro --volume=$(pwd)/../../debs:/debs \
+           -e TARGET_USERID=$(id -u) \
+           -e TARGET_GROUPID=$(id -g) \
+           dh-venv-builder:${TAG}
+done