From d7d658965b47736c4433f8345e6fdc35fdc1a7e1 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Thu, 9 Mar 2023 18:43:54 +0000 Subject: [PATCH 1/2] Install rust during Stage 0 of docker build Thanks to @atomdmac for spotting the fix. Fixes #15179. --- docker/Dockerfile | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index a85fd3d691c8..3d07bcd71f06 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -37,9 +37,24 @@ RUN \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt-get update -qq && apt-get install -yqq \ - build-essential git libffi-dev libssl-dev \ + build-essential curl git libffi-dev libssl-dev \ && rm -rf /var/lib/apt/lists/* +# Install rust and ensure its in the PATH. +# (Rust may be needed to compile `cryptography`---which is one of poetry's +# dependencies---on platforms that don't have a `cryptography` wheel. +ENV RUSTUP_HOME=/rust +ENV CARGO_HOME=/cargo +ENV PATH=/cargo/bin:/rust/bin:$PATH +RUN mkdir /rust /cargo + +RUN curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain stable --profile minimal + +# arm64 builds consume a lot of memory if `CARGO_NET_GIT_FETCH_WITH_CLI` is not +# set to true, so we expose it as a build-arg. +ARG CARGO_NET_GIT_FETCH_WITH_CLI=false +ENV CARGO_NET_GIT_FETCH_WITH_CLI=$CARGO_NET_GIT_FETCH_WITH_CLI + # We install poetry in its own build stage to avoid its dependencies conflicting with # synapse's dependencies. RUN --mount=type=cache,target=/root/.cache/pip \ From a676825992730496db1e8741fe2d9a4f65308dc7 Mon Sep 17 00:00:00 2001 From: David Robertson Date: Thu, 9 Mar 2023 18:48:17 +0000 Subject: [PATCH 2/2] Changelog --- changelog.d/15239.docker | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/15239.docker diff --git a/changelog.d/15239.docker b/changelog.d/15239.docker new file mode 100644 index 000000000000..2aad329e99b3 --- /dev/null +++ b/changelog.d/15239.docker @@ -0,0 +1 @@ +Ensure the Dockerfile builds on platforms that don't have a `cryptography` wheel.