mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 07:43:51 +01:00
1def298119
This is basically a contrived way of adding a `Recommends` on `libpq5`, to fix #5653. The way this is supposed to happen in debhelper is to run `dh_shlibdeps`, which in turn runs `dpkg-shlibdeps`, which spits things out into `debian/<package>.substvars` whence they can later be included by `control`. Previously, we had disabled `dh_shlibdeps`, mostly because `dpkg-shlibdeps` gets confused about PIL's interdependent objects, but that's not really the right thing to do and there is another way to work around that. Since we don't always use postgres, we don't necessarily want a hard Depends on libpq5, so I've actually ended up adding an explicit invocation of `dpkg-shlibdeps` for `psycopg2`. I've also updated the build-depends list for the package, which was missing a couple of entries.
74 lines
2.3 KiB
Text
74 lines
2.3 KiB
Text
# A dockerfile which builds a docker image for building a debian package for
|
|
# synapse. The distro to build for is passed as a docker build var.
|
|
#
|
|
# The default entrypoint expects the synapse source to be mounted as a
|
|
# (read-only) volume at /synapse/source, and an output directory at /debs.
|
|
#
|
|
# A pair of environment variables (TARGET_USERID and TARGET_GROUPID) can be
|
|
# passed to the docker container; if these are set, the build script will chown
|
|
# the build products accordingly, to avoid ending up with things owned by root
|
|
# in the host filesystem.
|
|
|
|
# Get the distro we want to pull from as a dynamic build variable
|
|
ARG distro=""
|
|
|
|
###
|
|
### Stage 0: build a dh-virtualenv
|
|
###
|
|
FROM ${distro} as builder
|
|
|
|
RUN apt-get update -qq -o Acquire::Languages=none
|
|
RUN env DEBIAN_FRONTEND=noninteractive apt-get install \
|
|
-yqq --no-install-recommends \
|
|
build-essential \
|
|
ca-certificates \
|
|
devscripts \
|
|
equivs \
|
|
wget
|
|
|
|
# fetch and unpack the package
|
|
RUN wget -q -O /dh-virtuenv-1.1.tar.gz https://github.com/spotify/dh-virtualenv/archive/1.1.tar.gz
|
|
RUN tar xvf /dh-virtuenv-1.1.tar.gz
|
|
|
|
# install its build deps
|
|
RUN cd dh-virtualenv-1.1/ \
|
|
&& env DEBIAN_FRONTEND=noninteractive mk-build-deps -ri -t "apt-get -yqq --no-install-recommends"
|
|
|
|
# build it
|
|
RUN cd dh-virtualenv-1.1 && dpkg-buildpackage -us -uc -b
|
|
|
|
###
|
|
### Stage 1
|
|
###
|
|
FROM ${distro}
|
|
|
|
# Install the build dependencies
|
|
#
|
|
# NB: keep this list in sync with the list of build-deps in debian/control
|
|
# TODO: it would be nice to do that automatically.
|
|
RUN apt-get update -qq -o Acquire::Languages=none \
|
|
&& env DEBIAN_FRONTEND=noninteractive apt-get install \
|
|
-yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \
|
|
build-essential \
|
|
debhelper \
|
|
devscripts \
|
|
dh-systemd \
|
|
libsystemd-dev \
|
|
lsb-release \
|
|
pkg-config \
|
|
python3-dev \
|
|
python3-pip \
|
|
python3-setuptools \
|
|
python3-venv \
|
|
sqlite3 \
|
|
libpq-dev
|
|
|
|
COPY --from=builder /dh-virtualenv_1.1-1_all.deb /
|
|
|
|
# install dhvirtualenv. Update the apt cache again first, in case we got a
|
|
# cached cache from docker the first time.
|
|
RUN apt-get update -qq -o Acquire::Languages=none \
|
|
&& apt-get install -yq /dh-virtualenv_1.1-1_all.deb
|
|
|
|
WORKDIR /synapse/source
|
|
ENTRYPOINT ["bash","/synapse/source/docker/build_debian.sh"]
|