From 5805cbad4cd7a9cfb82e752fcb5d653eabf98af6 Mon Sep 17 00:00:00 2001 From: nicobo Date: Wed, 10 Feb 2021 21:42:25 +0100 Subject: [PATCH] - disabling back rust extension for cryptography as it raises again the 'rust fix' build problem but it cannot be solved as for signal --- alpine.Dockerfile | 2 ++ debian.Dockerfile | 50 ++++++++++++++++++++------------------- docker/docker-images.puml | 4 ++-- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/alpine.Dockerfile b/alpine.Dockerfile index d2c5d32..6612440 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -43,6 +43,8 @@ RUN apk add --no-cache build-base gcc abuild binutils cmake \ # https://forge.rust-lang.org/infra/other-installation-methods.html # Alpine packages : https://pkgs.alpinelinux.org/packages?name=rust #RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # TODO Maybe use the rust image as in debian.Dockerfile (pros : should work ootb + # cons: limited in platforms and the copy might break if the image changes) cargo rust \ # git required by setuptools-scm during 'pip install' git diff --git a/debian.Dockerfile b/debian.Dockerfile index bccae40..fe3773c 100644 --- a/debian.Dockerfile +++ b/debian.Dockerfile @@ -2,7 +2,7 @@ # STAGE 1 : Builder image # -# This builder must have a Python version comptabile with the final image +# This builder must have a Python version compatible with the final image # So built artifacts will work FROM python:3 as builder @@ -20,23 +20,23 @@ RUN apt-get update && \ # git required by setuptools-scm during 'pip install' git -# Rust is a requirement to build the 'cryptography' Python module -# but it's sooo complicated to install it on many platforms... -# The recommended procedure is to use 'rustup but Alpine ships with more CPU -# architectures so we use the OS' packages. (At the time of writing rustup only -# provides installers for x86_64 and aarch64 (arm64).) -# https://forge.rust-lang.org/infra/other-installation-methods.html -# Alpine packages : https://pkgs.alpinelinux.org/packages?name=rust -# Debian packages : https://packages.debian.org/buster/rustc -# FIXME The rustup script does not work for linux/386 : it seems it installs x86_64 instead -#RUN (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && . $HOME/.cargo/env) || apt-get install -y rustc -# As of writing, copying from the rust image is supported for the following archs : 386,amd64,armv7,arm64 -COPY --from=rust:slim /usr/local/cargo /usr/local/cargo -COPY --from=rust:slim /usr/local/rustup /usr/local/rustup -ENV RUSTUP_HOME=/usr/local/rustup \ - CARGO_HOME=/usr/local/cargo \ - PATH=/usr/local/cargo/bin:$PATH -RUN rustc --version +# # Rust is a requirement to build the 'cryptography' Python module +# # but it's sooo complicated to install it on many platforms... +# # The recommended procedure is to use 'rustup but Alpine ships with more CPU +# # architectures so we use the OS' packages. (At the time of writing rustup only +# # provides installers for x86_64 and aarch64 (arm64).) +# # https://forge.rust-lang.org/infra/other-installation-methods.html +# # Alpine packages : https://pkgs.alpinelinux.org/packages?name=rust +# # Debian packages : https://packages.debian.org/buster/rustc +# # FIXME The rustup script does not work for linux/386 : it seems it installs x86_64 instead +# #RUN (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && . $HOME/.cargo/env) || apt-get install -y rustc +# # As of writing, copying from the rust image is supported for the following archs : 386,amd64,armv7,arm64 +# COPY --from=rust:slim /usr/local/cargo /usr/local/cargo +# COPY --from=rust:slim /usr/local/rustup /usr/local/rustup +# ENV RUSTUP_HOME=/usr/local/rustup \ +# CARGO_HOME=/usr/local/cargo \ +# PATH=/usr/local/cargo/bin:$PATH +# RUN rustc --version WORKDIR /usr/src/app @@ -45,12 +45,14 @@ COPY constraints.txt \ requirements-*.txt \ setup.py \ . -# # FIXME Either with rustup or rustc package, rust version for linux/386 on debian is only 1.41 as of buster -# # => Since 3.4.3 cryptography requires rust 1.45+, which is not available on all platforms -# # https://cryptography.io/en/latest/changelog.html#v3-4-3 -# # => For now we use the patch below to disable rust but the next version of cryptography -# # will probably force us to use packages from debian testing or to use an older cryptography version -# ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 +# FIXME Either with rustup or rustc package, rust version for linux/386 on debian is only 1.41 as of buster +# => Since 3.4.3 cryptography requires rust 1.45+, which is not available on all platforms +# https://cryptography.io/en/latest/changelog.html#v3-4-3 +# => For now we use the patch below to disable rust but the next version of cryptography +# will probably force us to use packages from debian testing or to use an older cryptography version +# FIXME Also, after using all patches that I could find, I finally end up having this issue : https://github.com/nicolabs/nicobot/issues/59 +# So Rust extensions are now officially disabled until cryptography builds again on ARM +ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 # This step WILL trigger a compilation on platforms without matching Python wheels RUN python3 -m pip install --no-cache-dir --user --upgrade pip && \ python3 -m pip install --no-cache-dir --user -c constraints.txt -r requirements-build.txt -r requirements-runtime.txt diff --git a/docker/docker-images.puml b/docker/docker-images.puml index e695eb4..81181ea 100644 --- a/docker/docker-images.puml +++ b/docker/docker-images.puml @@ -16,7 +16,7 @@ left to right direction object "Docker context" as docker_context $dockercontext object "python:3" as python3 $baseimage object "python:3-slim" as python3_slim $baseimage -object "rust:slim" as rust_slim $baseimage +'object "rust:slim" as rust_slim $baseimage object "debian builder" as nicobot_debian_builder <> $tempimage { Builds nicobot & dependencies } @@ -25,7 +25,7 @@ object "nicolabs/nicobot:debian" as nicobot_debian $finalimage { } python3 --> nicobot_debian_builder : FROM -rust_slim --> nicobot_debian_builder : COPY +'rust_slim --> nicobot_debian_builder : COPY docker_context ...> nicobot_debian_builder : COPY python3_slim --> nicobot_debian : FROM