1+ # We need recent curl, OpenSSL and CA certificates, so we can download further
2+ # dependencies in the debian:6 image. We use an ubuntu 20.04 image download
3+ # those.
4+ FROM ubuntu:20.04
5+ RUN apt-get update && \
6+ apt-get install -y --no-install-recommends \
7+ curl \
8+ ca-certificates
9+ WORKDIR /tmp
10+ COPY host-x86_64/dist-x86_64-linux/download-openssl-curl.sh /tmp/
11+ RUN ./download-openssl-curl.sh
12+
113# We use Debian 6 (glibc 2.11, kernel 2.6.32) as a common base for other
214# distros that still need Rust support: RHEL 6 (glibc 2.12, kernel 2.6.32) and
315# SLES 11 SP4 (glibc 2.11, kernel 3.0).
@@ -14,8 +26,6 @@ RUN apt-get update && \
1426 apt-get install --allow-unauthenticated -y --no-install-recommends \
1527 automake \
1628 bzip2 \
17- ca-certificates \
18- curl \
1929 file \
2030 g++ \
2131 g++-multilib \
@@ -34,11 +44,6 @@ RUN apt-get update && \
3444 xz-utils \
3545 zlib1g-dev
3646
37- # Install new Let's Encrypt root CA certificate and remove the expired one.
38- COPY host-x86_64/shared/ISRG_Root_X1.crt /usr/local/share/ca-certificates/ISRG_Root_X1.crt
39- RUN sed -i '/mozilla\/ DST_Root_CA_X3\. crt/d' /etc/ca-certificates.conf
40- RUN /usr/sbin/update-ca-certificates
41-
4247ENV PATH=/rustroot/bin:$PATH
4348ENV LD_LIBRARY_PATH=/rustroot/lib64:/rustroot/lib32:/rustroot/lib
4449ENV PKG_CONFIG_PATH=/rustroot/lib/pkgconfig
@@ -50,6 +55,7 @@ COPY host-x86_64/dist-x86_64-linux/shared.sh /tmp/
5055# static.rust-lang.org. This'll be used to link into libcurl below (and used
5156# later as well), so build a copy of OpenSSL with dynamic libraries into our
5257# generic root.
58+ COPY --from=0 /tmp/openssl.tar.gz /tmp/openssl.tar.gz
5359COPY host-x86_64/dist-x86_64-linux/build-openssl.sh /tmp/
5460RUN ./build-openssl.sh
5561
@@ -59,8 +65,13 @@ RUN ./build-openssl.sh
5965#
6066# Note that we also disable a bunch of optional features of curl that we don't
6167# really need.
68+ COPY --from=0 /tmp/curl.tar.xz /tmp/curl.tar.xz
6269COPY host-x86_64/dist-x86_64-linux/build-curl.sh /tmp/
63- RUN ./build-curl.sh && apt-get remove -y curl
70+ RUN ./build-curl.sh
71+
72+ # Use up-to-date curl CA bundle
73+ COPY --from=0 /tmp/cacert.pem /tmp/cacert.pem
74+ ENV CURL_CA_BUNDLE /tmp/cacert.pem
6475
6576# binutils < 2.22 has a bug where the 32-bit executables it generates
6677# immediately segfault in Rust, so we need to install our own binutils.
0 commit comments