- disabling back rust extension for cryptography as it raises again the 'rust fix' build problem but it cannot be solved as for signal

This commit is contained in:
nicobo 2021-02-10 21:42:25 +01:00
parent 73a95157d8
commit 5805cbad4c
No known key found for this signature in database
GPG key ID: 2581E71C5FA5285F
3 changed files with 30 additions and 26 deletions

View file

@ -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 # https://forge.rust-lang.org/infra/other-installation-methods.html
# Alpine packages : https://pkgs.alpinelinux.org/packages?name=rust # Alpine packages : https://pkgs.alpinelinux.org/packages?name=rust
#RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y #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 \ cargo rust \
# git required by setuptools-scm during 'pip install' # git required by setuptools-scm during 'pip install'
git git

View file

@ -2,7 +2,7 @@
# STAGE 1 : Builder image # 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 # So built artifacts will work
FROM python:3 as builder FROM python:3 as builder
@ -20,23 +20,23 @@ RUN apt-get update && \
# git required by setuptools-scm during 'pip install' # git required by setuptools-scm during 'pip install'
git git
# Rust is a requirement to build the 'cryptography' Python module # # Rust is a requirement to build the 'cryptography' Python module
# but it's sooo complicated to install it on many platforms... # # but it's sooo complicated to install it on many platforms...
# The recommended procedure is to use 'rustup but Alpine ships with more CPU # # 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 # # architectures so we use the OS' packages. (At the time of writing rustup only
# provides installers for x86_64 and aarch64 (arm64).) # # provides installers for x86_64 and aarch64 (arm64).)
# https://forge.rust-lang.org/infra/other-installation-methods.html # # https://forge.rust-lang.org/infra/other-installation-methods.html
# Alpine packages : https://pkgs.alpinelinux.org/packages?name=rust # # Alpine packages : https://pkgs.alpinelinux.org/packages?name=rust
# Debian packages : https://packages.debian.org/buster/rustc # # 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 # # 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 # #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 # # 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/cargo /usr/local/cargo
COPY --from=rust:slim /usr/local/rustup /usr/local/rustup # COPY --from=rust:slim /usr/local/rustup /usr/local/rustup
ENV RUSTUP_HOME=/usr/local/rustup \ # ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \ # CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH # PATH=/usr/local/cargo/bin:$PATH
RUN rustc --version # RUN rustc --version
WORKDIR /usr/src/app WORKDIR /usr/src/app
@ -45,12 +45,14 @@ COPY constraints.txt \
requirements-*.txt \ requirements-*.txt \
setup.py \ setup.py \
. .
# # FIXME Either with rustup or rustc package, rust version for linux/386 on debian is only 1.41 as of buster # 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 # => 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 # 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 # => 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 # will probably force us to use packages from debian testing or to use an older cryptography version
# ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 # 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 # This step WILL trigger a compilation on platforms without matching Python wheels
RUN python3 -m pip install --no-cache-dir --user --upgrade pip && \ 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 python3 -m pip install --no-cache-dir --user -c constraints.txt -r requirements-build.txt -r requirements-runtime.txt

View file

@ -16,7 +16,7 @@ left to right direction
object "Docker context" as docker_context $dockercontext object "Docker context" as docker_context $dockercontext
object "<i>python:3</i>" as python3 $baseimage object "<i>python:3</i>" as python3 $baseimage
object "<i>python:3-slim</i>" as python3_slim $baseimage object "<i>python:3-slim</i>" as python3_slim $baseimage
object "<i>rust:slim</i>" as rust_slim $baseimage 'object "<i>rust:slim</i>" as rust_slim $baseimage
object "debian builder" as nicobot_debian_builder <<temp>> $tempimage { object "debian builder" as nicobot_debian_builder <<temp>> $tempimage {
Builds nicobot & dependencies Builds nicobot & dependencies
} }
@ -25,7 +25,7 @@ object "nicolabs/nicobot:debian" as nicobot_debian $finalimage {
} }
python3 --> nicobot_debian_builder : FROM python3 --> nicobot_debian_builder : FROM
rust_slim --> nicobot_debian_builder : COPY 'rust_slim --> nicobot_debian_builder : COPY
docker_context ...> nicobot_debian_builder : COPY docker_context ...> nicobot_debian_builder : COPY
python3_slim --> nicobot_debian : FROM python3_slim --> nicobot_debian : FROM