From 02e44bd407f9ed3f736cfc26a2d6a920a47ea346 Mon Sep 17 00:00:00 2001 From: Jonas Alfredsson Date: Tue, 13 Aug 2024 10:20:43 +0200 Subject: [PATCH] Install latest rustc/cargo The cryptography Python package requires rustc >= 1.65.0 to build now, and Debian only comes with 1.63.0 by default. We therefore utilize the rustup installation script, similar to the get-pip.py script, to get the latest version. --- src/Dockerfile | 7 ++++--- src/Dockerfile-alpine | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Dockerfile b/src/Dockerfile index ac39f23..9b0bd88 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -34,7 +34,6 @@ RUN set -ex && \ apt-get update && \ apt-get install -y --no-install-recommends \ build-essential \ - cargo \ curl \ libffi8 \ libffi-dev \ @@ -45,6 +44,9 @@ RUN set -ex && \ python3 \ python3-dev \ && \ +# Install the latest version of rustc/cargo. + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ + . "$HOME/.cargo/env" && \ # Install the latest version of PIP, Setuptools and Wheel. curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3 && \ # Install certbot. @@ -54,18 +56,17 @@ RUN set -ex && \ # Remove everything that is no longer necessary. apt-get remove --purge -y \ build-essential \ - cargo \ curl \ libffi-dev \ libssl-dev \ pkg-config \ python3-dev \ && \ + rustup self uninstall -y && \ apt-get autoremove -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ rm -rf /root/.cache && \ - rm -rf /root/.cargo && \ # Create new directories and set correct permissions. mkdir -p /var/www/letsencrypt && \ mkdir -p /etc/nginx/user_conf.d && \ diff --git a/src/Dockerfile-alpine b/src/Dockerfile-alpine index 670a07e..8406886 100644 --- a/src/Dockerfile-alpine +++ b/src/Dockerfile-alpine @@ -33,7 +33,6 @@ RUN set -ex && \ # Install packages necessary during the build phase (for all architectures). apk add --no-cache \ bash \ - cargo \ curl \ findutils \ libffi \ @@ -46,6 +45,9 @@ RUN set -ex && \ python3-dev \ sed \ && \ +# Install the latest version of rustc/cargo. + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ + . "$HOME/.cargo/env" && \ # Install the latest version of PIP, Setuptools and Wheel. curl -L 'https://bootstrap.pypa.io/get-pip.py' | python3 && \ # Install certbot. @@ -54,14 +56,13 @@ RUN set -ex && \ pip3 install $(echo $CERTBOT_DNS_AUTHENTICATORS | sed 's/\(^\| \)/\1certbot-dns-/g') && \ # Remove everything that is no longer necessary. apk del \ - cargo \ curl \ libffi-dev \ libressl-dev \ python3-dev \ && \ + rustup self uninstall -y && \ rm -rf /root/.cache && \ - rm -rf /root/.cargo && \ # Create new directories and set correct permissions. mkdir -p /var/www/letsencrypt && \ mkdir -p /etc/nginx/user_conf.d && \