content: # A dockerfile which builds a docker image for building a debian package for
  # abrechnung. The distro to build for is passed as a docker build var.
  # Taken from https://github.com/matrix-org/synapse/blob/develop/debian/build_virtualenv, released under Apache 2
  #
  # The default entrypoint expects the synapse source to be mounted as a
  # (read-only) volume at /abrechnung/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 1
  ###
  FROM ${distro}
  
  # Get the distro we want to pull from as a dynamic build variable
  # (We need to define it in each build stage)
  ARG distro=""
  ENV distro ${distro}
  
  # Python < 3.7 assumes LANG="C" means ASCII-only and throws on printing unicode
  # http://bugs.python.org/issue19846
  ENV LANG C.UTF-8
  
  # 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 -y -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 \
          libsystemd-dev \
          lsb-release \
          pkg-config \
          python3-dev \
          python3-pip \
          python3-setuptools \
          python3-venv \
          sqlite3 \
          curl \
          libpq-dev \
          xmlsec1 \
          dh-virtualenv
  
  # install yarn
  RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
  RUN apt-get install -y nodejs
  
  COPY . /stustapay/build
  WORKDIR /stustapay/build
  ENTRYPOINT ["bash", "/stustapay/build/docker/build_debian.sh"]
  