diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index de823bf1c..1582dfcf5 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -115,6 +115,10 @@ FROM base AS wheels ARG DEBIAN_FRONTEND ARG TARGETARCH +RUN --mount=type=bind,source=docker/tensorrt/install_python_39.sh,target=/deps/install_python_39.sh \ + --mount=type=cache,target=/root/.ccache \ + /deps/install_python_39.sh + # Use a separate container to build wheels to prevent build dependencies in final image RUN apt-get -qq update \ && apt-get -qq install -y \ @@ -128,8 +132,6 @@ RUN apt-get -qq update \ tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \ && apt-get -qq update \ && apt-get -qq install -y \ - python3.9 \ - python3.9-dev \ # opencv dependencies build-essential cmake git pkg-config libgtk-3-dev \ libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ @@ -142,7 +144,7 @@ RUN apt-get -qq update \ rm -rf /var/lib/apt/lists/* # Ensure python3 defaults to python3.9 -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 +# RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ && python3 get-pip.py "pip" diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index 43fff479b..72cc30b9b 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -4,13 +4,28 @@ set -euxo pipefail apt-get -qq update +if [ -e /usr/local/cuda-12.2 ]; then + apt-get update && \ + apt-get install wget build-essential ccache clang cmake pkg-config -y + + wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz + tar -xf Python-3.9.6.tgz + cd Python-3.9.6 + ./configure --enable-optimizations + make altinstall +else + apt-get -qq update \ + && apt-get -qq install -y --no-install-recommends \ + python3.9 \ + && rm -rf /var/lib/apt/lists/* +fi + apt-get -qq install --no-install-recommends -y \ apt-transport-https \ gnupg \ wget \ procps vainfo \ unzip locales tzdata libxml2 xz-utils \ - python3.9 \ python3-pip \ curl \ jq \ diff --git a/docker/tensorrt/Dockerfile.arm64 b/docker/tensorrt/Dockerfile.arm64 index 70184bf9b..202a92a0d 100644 --- a/docker/tensorrt/Dockerfile.arm64 +++ b/docker/tensorrt/Dockerfile.arm64 @@ -8,14 +8,17 @@ FROM ${BASE_IMAGE} AS build-wheels ARG DEBIAN_FRONTEND # Use a separate container to build wheels to prevent build dependencies in final image -RUN apt-get -qq update \ - && apt-get -qq install -y --no-install-recommends \ - python3.9 python3.9-dev \ - wget build-essential cmake git \ - && rm -rf /var/lib/apt/lists/* +RUN --mount=type=bind,source=docker/tensorrt/install_python_39.sh,target=/deps/install_python_39.sh \ + --mount=type=cache,target=/root/.ccache \ + /deps/install_python_39.sh +#RUN apt-get -qq update \ +# && apt-get -qq install -y --no-install-recommends \ +# python3.9 python3.9-dev \ +# wget build-essential cmake git \ +# && rm -rf /var/lib/apt/lists/* # Ensure python3 defaults to python3.9 -RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 +# RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \ && python3 get-pip.py "pip" diff --git a/docker/tensorrt/build_jetson_ffmpeg.sh b/docker/tensorrt/build_jetson_ffmpeg.sh index 0e047132d..72f06d678 100755 --- a/docker/tensorrt/build_jetson_ffmpeg.sh +++ b/docker/tensorrt/build_jetson_ffmpeg.sh @@ -27,13 +27,7 @@ if [ -e /usr/local/cuda-12.2 ]; then apt-get update - apt-get install nvidia-l4t-jetson-multimedia-api -y - - wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz - tar -xf Python-3.9.6.tgz - cd Python-3.9.6 - ./configure --enable-optimizations - sudo make altinstall + apt-get install nvidia-l4t-jetson-multimedia-api -o Dpkg::Options::="--force-confold" --force-yes -y elif [ -e /usr/local/cuda-10.2 ]; then # assume Jetpack 4.X wget -q https://developer.nvidia.com/embedded/L4T/r32_Release_v5.0/T186/Jetson_Multimedia_API_R32.5.0_aarch64.tbz2 -O jetson_multimedia_api.tbz2 diff --git a/docker/tensorrt/install_python_39.sh b/docker/tensorrt/install_python_39.sh new file mode 100755 index 000000000..4688a8e6d --- /dev/null +++ b/docker/tensorrt/install_python_39.sh @@ -0,0 +1,20 @@ +if [ -e /usr/local/cuda-12.2 ]; then + apt-get update && \ + apt-get install wget build-essential ccache clang cmake pkg-config -y + + wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz + tar -xf Python-3.9.6.tgz + cd Python-3.9.6 + ./configure --enable-optimizations + make altinstall + + update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.9 1 +else + apt-get -qq update \ + && apt-get -qq install -y --no-install-recommends \ + python3.9 python3.9-dev \ + wget build-essential cmake git \ + && rm -rf /var/lib/apt/lists/* + + update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 +fi