From b0a34b373a77bad702cc05f5d6d8fa90986c6623 Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Thu, 26 Oct 2023 18:21:02 -0700 Subject: [PATCH] chore(release) install Python 3.8+ in older distributions Fixing V8 build issues, see NVIDIA/DeepLearningExamples#1016 Fixes #430 --- .../Dockerfiles/Dockerfile.amd64.centos7 | 4 ++-- .../Dockerfiles/Dockerfile.amd64.centos8 | 2 +- .../Dockerfiles/Dockerfile.amd64.ubuntu-18.04 | 11 ++++++++++ util/release.sh | 20 +++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/assets/release/Dockerfiles/Dockerfile.amd64.centos7 b/assets/release/Dockerfiles/Dockerfile.amd64.centos7 index 62ea24da4..cb9864507 100644 --- a/assets/release/Dockerfiles/Dockerfile.amd64.centos7 +++ b/assets/release/Dockerfiles/Dockerfile.amd64.centos7 @@ -1,4 +1,5 @@ -FROM amd64/centos:7 +# Use Python 3.8+ (required by V8's GN build system) +FROM registry.access.redhat.com/ubi8/python-38 COPY . /ngx_wasm_module RUN yum install -y epel-release && \ @@ -13,7 +14,6 @@ RUN yum install -y epel-release && \ cmake3 \ make \ gcc \ - python3 \ git \ glib2-devel \ perl \ diff --git a/assets/release/Dockerfiles/Dockerfile.amd64.centos8 b/assets/release/Dockerfiles/Dockerfile.amd64.centos8 index 7ecb451e8..9f374b4dc 100644 --- a/assets/release/Dockerfiles/Dockerfile.amd64.centos8 +++ b/assets/release/Dockerfiles/Dockerfile.amd64.centos8 @@ -13,7 +13,7 @@ RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \ libstdc++-devel \ libatomic \ perl \ - python3 \ + python39 \ git \ glib2-devel diff --git a/assets/release/Dockerfiles/Dockerfile.amd64.ubuntu-18.04 b/assets/release/Dockerfiles/Dockerfile.amd64.ubuntu-18.04 index bfe8bb2f7..835172842 100644 --- a/assets/release/Dockerfiles/Dockerfile.amd64.ubuntu-18.04 +++ b/assets/release/Dockerfiles/Dockerfile.amd64.ubuntu-18.04 @@ -26,8 +26,19 @@ RUN apt-get install -y --no-install-recommends \ pip3 install scikit-build && \ pip3 install cmake +# Install Python 3.8+ (required by V8's GN build system) +RUN apt-get install -y software-properties-common && \ + add-apt-repository -y ppa:deadsnakes/ppa && \ + apt-get update && \ + apt-get install -y python3.8 && \ + echo -e '#!/bin/bash\npython3.8' > /usr/bin/python3 && \ + chmod +x /usr/bin/python3 && \ + echo 'alias python3="python3.8"' >> ~/.bashrc + ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo ENV PATH $CARGO_HOME/bin:$PATH RUN mkdir -p "$CARGO_HOME" && mkdir -p "$RUSTUP_HOME" && \ curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable && \ chmod -R a=rwX $CARGO_HOME $RUSTUP_HOME + +SHELL ["/bin/bash", "-l", "-c"] diff --git a/util/release.sh b/util/release.sh index c0afabc23..15ebb008a 100755 --- a/util/release.sh +++ b/util/release.sh @@ -373,6 +373,26 @@ release_bin() { notice "Building $arch binary..." + notice "Debug" + ps -p $$ + [[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive' + shopt -q login_shell && echo 'Login shell' || echo 'Not login shell' + if [ -x "$(command -v python)" ]; then + python -V + else + echo "no python" + fi + if [ -x "$(command -v python3)" ]; then + python3 -V + else + echo "no python3" + fi + if [ -f ~/.profile ]; then + cat ~/.profile + else + echo "no .profile" + fi + if [ "$(get_distro)" = "centos7" ]; then notice "Enabling devtoolset-8 for CentOS..." source /opt/rh/devtoolset-8/enable