WORKDIR /build/
+# Build cmake before musl toolchain, as we replace the compiler during that step.
+COPY scripts/cmake.sh /scripts/
+RUN /scripts/cmake.sh
+
COPY scripts/musl-toolchain.sh /build/
# We need to mitigate rust-lang/rust#34978 when compiling musl itself as well
RUN CFLAGS="-Wa,-mrelax-relocations=no -Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=none" \