1
0

Dockerfile-dhvirtualenv 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # A dockerfile which builds a docker image for building a debian package for
  2. # synapse. The distro to build for is passed as a docker build var.
  3. #
  4. # The default entrypoint expects the synapse source to be mounted as a
  5. # (read-only) volume at /synapse/source, and an output directory at /debs.
  6. #
  7. # A pair of environment variables (TARGET_USERID and TARGET_GROUPID) can be
  8. # passed to the docker container; if these are set, the build script will chown
  9. # the build products accordingly, to avoid ending up with things owned by root
  10. # in the host filesystem.
  11. # Get the distro we want to pull from as a dynamic build variable
  12. ARG distro=""
  13. ###
  14. ### Stage 0: build a dh-virtualenv
  15. ###
  16. FROM ${distro} as builder
  17. RUN apt-get update -qq -o Acquire::Languages=none
  18. RUN env DEBIAN_FRONTEND=noninteractive apt-get install \
  19. -yqq --no-install-recommends \
  20. build-essential \
  21. ca-certificates \
  22. devscripts \
  23. equivs \
  24. wget
  25. # fetch and unpack the package
  26. RUN wget -q -O /dh-virtuenv-1.1.tar.gz https://github.com/spotify/dh-virtualenv/archive/1.1.tar.gz
  27. RUN tar xvf /dh-virtuenv-1.1.tar.gz
  28. # install its build deps
  29. RUN cd dh-virtualenv-1.1/ \
  30. && env DEBIAN_FRONTEND=noninteractive mk-build-deps -ri -t "apt-get -yqq --no-install-recommends"
  31. # build it
  32. RUN cd dh-virtualenv-1.1 && dpkg-buildpackage -us -uc -b
  33. ###
  34. ### Stage 1
  35. ###
  36. FROM ${distro}
  37. # Get the distro we want to pull from as a dynamic build variable
  38. # (We need to define it in each build stage)
  39. ARG distro=""
  40. ENV distro ${distro}
  41. # Install the build dependencies
  42. #
  43. # NB: keep this list in sync with the list of build-deps in debian/control
  44. # TODO: it would be nice to do that automatically.
  45. RUN apt-get update -qq -o Acquire::Languages=none \
  46. && env DEBIAN_FRONTEND=noninteractive apt-get install \
  47. -yqq --no-install-recommends -o Dpkg::Options::=--force-unsafe-io \
  48. build-essential \
  49. debhelper \
  50. devscripts \
  51. dh-systemd \
  52. libsystemd-dev \
  53. lsb-release \
  54. pkg-config \
  55. python3-dev \
  56. python3-pip \
  57. python3-setuptools \
  58. python3-venv \
  59. sqlite3 \
  60. libpq-dev
  61. COPY --from=builder /dh-virtualenv_1.1-1_all.deb /
  62. # install dhvirtualenv. Update the apt cache again first, in case we got a
  63. # cached cache from docker the first time.
  64. RUN apt-get update -qq -o Acquire::Languages=none \
  65. && apt-get install -yq /dh-virtualenv_1.1-1_all.deb
  66. WORKDIR /synapse/source
  67. ENTRYPOINT ["bash","/synapse/source/docker/build_debian.sh"]