You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

76 lines
2.3 KiB

  1. # syntax=docker/dockerfile:1
  2. # This dockerfile builds an editable install of Synapse.
  3. #
  4. # Used by `complement.sh`. Not suitable for production use.
  5. ARG PYTHON_VERSION=3.9
  6. ###
  7. ### Stage 0: generate requirements.txt
  8. ###
  9. # We hardcode the use of Debian bookworm here because this could change upstream
  10. # and other Dockerfiles used for testing are expecting bookworm.
  11. FROM docker.io/library/python:${PYTHON_VERSION}-slim-bookworm
  12. # Install Rust and other dependencies (stolen from normal Dockerfile)
  13. # install the OS build deps
  14. RUN \
  15. --mount=type=cache,target=/var/cache/apt,sharing=locked \
  16. --mount=type=cache,target=/var/lib/apt,sharing=locked \
  17. apt-get update -qq && apt-get install -yqq \
  18. build-essential \
  19. libffi-dev \
  20. libjpeg-dev \
  21. libpq-dev \
  22. libssl-dev \
  23. libwebp-dev \
  24. libxml++2.6-dev \
  25. libxslt1-dev \
  26. openssl \
  27. zlib1g-dev \
  28. git \
  29. curl \
  30. gosu \
  31. libjpeg62-turbo \
  32. libpq5 \
  33. libwebp7 \
  34. xmlsec1 \
  35. libjemalloc2 \
  36. && rm -rf /var/lib/apt/lists/*
  37. ENV RUSTUP_HOME=/rust
  38. ENV CARGO_HOME=/cargo
  39. ENV PATH=/cargo/bin:/rust/bin:$PATH
  40. RUN mkdir /rust /cargo
  41. RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable --profile minimal
  42. # Make a base copy of the editable source tree, so that we have something to
  43. # install and build now — even though it's going to be covered up by a mount
  44. # at runtime.
  45. COPY synapse /editable-src/synapse/
  46. COPY rust /editable-src/rust/
  47. # ... and what we need to `pip install`.
  48. COPY pyproject.toml poetry.lock README.rst build_rust.py Cargo.toml Cargo.lock /editable-src/
  49. RUN pip install poetry
  50. RUN poetry config virtualenvs.create false
  51. RUN cd /editable-src && poetry install --extras all
  52. # Make copies of useful things for inspection:
  53. # - the Rust module (must be copied to the editable source tree before startup)
  54. # - poetry.lock is useful for checking if dependencies have changed.
  55. RUN cp /editable-src/synapse/synapse_rust.abi3.so /synapse_rust.abi3.so.bak
  56. RUN cp /editable-src/poetry.lock /poetry.lock.bak
  57. ### Extra setup from original Dockerfile
  58. COPY ./docker/start.py /start.py
  59. COPY ./docker/conf /conf
  60. EXPOSE 8008/tcp 8009/tcp 8448/tcp
  61. ENTRYPOINT ["/start.py"]
  62. HEALTHCHECK --start-period=5s --interval=15s --timeout=5s \
  63. CMD curl -fSs http://localhost:8008/health || exit 1