From 29cea1bbeb6e4f9f04ecf055b91ae1056396edd5 Mon Sep 17 00:00:00 2001 From: nicobo Date: Tue, 9 Feb 2021 13:02:40 +0100 Subject: [PATCH] ~ reverting to all pip install at the same place (cryptography doc was misleading) + trying both rustup and package method for debian, as packages are often outdated (at the opposite of alpine) --- alpine.Dockerfile | 10 ++-------- debian.Dockerfile | 30 ++++++++++++++---------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/alpine.Dockerfile b/alpine.Dockerfile index ce0a4d0..407e90b 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -14,13 +14,6 @@ FROM python:3-alpine as builder -# Very strange but it seems that cryptography should be installed before rust... -# Although I don't believe there is a wheel for Alpine, doing this way allows -# Debian & Alpine builds to be closer -# https://cryptography.io/en/latest/installation.html#rust -RUN python3 -m pip install --no-cache-dir --user --upgrade pip && \ - python3 -m pip install --no-cache-dir --user cryptography; exit 0 - # python:3-alpine misses gcc, ffi.h, ... # # GCC part : @@ -59,7 +52,8 @@ COPY requirements-*.txt \ setup.py \ . # This step WILL trigger a compilation on platforms without matching Python wheels -RUN python3 -m pip install --no-cache-dir --user -r requirements-build.txt -r requirements-runtime.txt +RUN python3 -m pip install --no-cache-dir --user --upgrade pip && \ + python3 -m pip install --no-cache-dir --user -r requirements-build.txt -r requirements-runtime.txt # Builds & installs nicobot (should change often, especially the .git directory) COPY LICENSE \ diff --git a/debian.Dockerfile b/debian.Dockerfile index 6e8fa0d..284cc42 100644 --- a/debian.Dockerfile +++ b/debian.Dockerfile @@ -4,11 +4,6 @@ FROM python:3 as builder -# Very strange but it seems that cryptography should be installed before rust... -# https://cryptography.io/en/latest/installation.html#rust -RUN python3 -m pip install --no-cache-dir --user --upgrade pip && \ - python3 -m pip install --no-cache-dir --user cryptography; exit 0 - RUN apt-get update && \ # The following fails on arm : https://github.com/docker/buildx/issues/495 apt-get install -y \ @@ -16,22 +11,24 @@ RUN apt-get update && \ # not all may be required on all platforms... # XEdDSA needs at least make & cmake (future versions will not : see https://github.com/Syndace/python-xeddsa) cmake g++ make \ - # Rust is a requirement to build the 'cryptography' Python module - # The recommended procedure is to use 'rustup but the both Debian & - # Alpine ship 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 - #RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y - rustc \ + # rustc \ # More dependencies for the 'cryptography' module # See https://cryptography.io/en/latest/installation.html#debian-ubuntu build-essential libssl-dev libffi-dev python3-dev \ # git required by setuptools-scm during 'pip install' git +# Rust is a requirement to build the 'cryptography' Python module +# The recommended procedure is to use 'rustup but the both Debian & +# Alpine ship 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 +# Here we try the official method first and fall back to the package +RUN (curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y) || apt-get install -y rustc + WORKDIR /usr/src/app # Builds & installs requirements (shoduld not change often) @@ -39,7 +36,8 @@ COPY requirements-*.txt \ setup.py \ . # This step WILL trigger a compilation on platforms without matching Python wheels -RUN python3 -m pip install --no-cache-dir --user -r requirements-build.txt -r requirements-runtime.txt +RUN python3 -m pip install --no-cache-dir --user --upgrade pip && \ + python3 -m pip install --no-cache-dir --user -r requirements-build.txt -r requirements-runtime.txt # Builds & installs nicobot (should change often, especially the .git directory) COPY LICENSE \