1212# is set in the build_docker script as the last param to the docker buildx command,
1313# namely the "../..". This takes us from /Installers/Docker to /. and then this
1414# image file proceeds
15- #
16- # BE AWARE: this cuDNN equipped build may lock up when two YOLO equipped modules
17- # are installed on it. Without cuDNN, .NET ONNX runtime for GPU doesn't work.
15+
1816
1917# INITIAL SETUP ===============================================================
2018
@@ -26,8 +24,7 @@ ARG DOTNET_VERSION=9.0
2624ARG CPAI_VERSION
2725
2826# CUDA_VERSION = 11.7.1-cudnn8, 11.8.0-cudnn8, 12.0.1-cudnn8, 12.2.2-cudnn8
29- # or cuDNN free: 11.7.1, 12.3.1
30- ARG CUDA_VERSION=11.7.1-cudnn8
27+ ARG CUDA_VERSION=12.2.2-cudnn8
3128ARG CUDA_MAJOR=11
3229
3330FROM nvidia/cuda:$CUDA_VERSION-runtime-ubuntu$UBUNTU_VERSION AS base
@@ -127,72 +124,77 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends \
127124 \
128125 psmisc \
129126 \
130- kmod \
131- > /dev/null
132- # libnvidia-compute-535 > /dev/null
133-
134- # Not needed. Probably.
135- # apt-utils
127+ kmod > /dev/null
136128
137129
138130# .NET ------------------------------------------------------------------------
139131
140- # Update packages and install NET
141- RUN wget "https://packages.microsoft.com/config/ubuntu/${UBUNTU_VERSION}/packages-microsoft-prod.deb" \
142- -O packages-microsoft-prod.deb --no-check-certificate && \
143- dpkg -i packages-microsoft-prod.deb && \
144- rm packages-microsoft-prod.deb && \
145- apt update && apt install aspnetcore-runtime-$DOTNET_VERSION -y > /dev/null
132+ # Update packages and install .NET
133+ RUN apt install software-properties-common -y && \
134+ add-apt-repository ppa:dotnet/backports -y && \
135+ apt-get update && apt-get install aspnetcore-runtime-$DOTNET_VERSION -y > /dev/null
146136
147137
148138# Setup Python ----------------------------------------------------------------
149139
150- RUN apt-get install software-properties-common -y && add-apt-repository ppa:deadsnakes/ppa -y
151-
152- # This (currently) installs python3.8 as a dependency. It could be in the future
153- # that a different version of python is installed instead, in which case we may
154- # need to pin the installed python version.
155- RUN apt-get install python3-pip -y && apt-get install python3-apt -y
156-
157- # Install Python3.8, distutils and dev tools (so packages can be built if needed)
158- # and pip install so we can install python packages
159- RUN apt-get install python3.8 -y && \
160- apt-get install python3.8-distutils -y && \
161- apt-get install python3.8-dev -y && \
162- python3.8 -m pip install --upgrade setuptools && \
163- python3.8 -m pip install --upgrade pip
164-
165- # install virtual env tools
166- RUN apt install python3-pip python3-setuptools python3.8-venv -y && \
167- python3.8 -m pip install virtualenv virtualenvwrapper
168-
169- # Install Python3.9, distutils and dev tools (so packages can be built if needed)
170- # and pip install so we can install python packages. We don't need this for the
171- # built in modules, but we know we have downloadable modules that could use Python3.9
172- # so we preempt the need.
173- RUN apt-get install python3.9 -y && \
174- apt-get install python3.9-distutils -y && \
175- apt-get install python3.9-dev -y && \
176- python3.9 -m pip install --upgrade setuptools && \
177- python3.9 -m pip install --upgrade pip
178-
179- #RUN apt python3.9-venv -y
180- RUN apt install python3.9-venv -y && \
181- python3.9 -m pip install virtualenv virtualenvwrapper
182-
183- # Install Python3.11, distutils and dev tools (so packages can be built if needed)
184- # and pip install so we can install python packages. We don't need this for the
185- # built in modules, but we know we have downloadable modules that could use Python3.9
186- # so we preempt the need.
187- RUN apt-get install python3.11 -y && \
188- apt-get install python3.11-distutils -y && \
189- apt-get install python3.11-dev -y && \
190- python3.11 -m pip install --upgrade setuptools && \
191- python3.11 -m pip install --upgrade pip
192-
193- #RUN apt python3.11-venv -y
194- RUN apt install python3.11-venv -y && \
195- python3.11 -m pip install virtualenv virtualenvwrapper
140+ # Combining all these together into a single layer
141+ # 1. Add deadsnakes repo
142+ # 2. Install pip for python3, python3-apt and python3-setuptools
143+ # Note that this (currently) installs python3.8 as a dependency. It could be
144+ # in the future that a different version of python is installed instead, in
145+ # which case we may need to pin the installed python version.
146+ # 3. Install Python 3.8 as well as dev and distutils so packages can be built
147+ # if needed, and venv for creating virtual environments
148+ # 4. Using the now installed Python 3.8, upgrade the python setuptools and dev
149+ # packages to the latest
150+ # 5. Install virtualenv virtualenvwrapper for python 3.8
151+
152+ RUN apt-get install software-properties-common -y && \
153+ add-apt-repository ppa:deadsnakes/ppa -y && \
154+ apt-get install -y --no-install-recommends \
155+ python3-pip \
156+ python3-apt \
157+ python3-setuptools && \
158+ apt-get install -y --no-install-recommends \
159+ python3.8 && \
160+ apt-get install -y --no-install-recommends \
161+ python3.8-distutils \
162+ python3.8-dev \
163+ python3.8-venv && \
164+ python3.8 -m pip install --upgrade setuptools && \
165+ python3.8 -m pip install --upgrade pip && \
166+ python3.8 -m pip install virtualenv virtualenvwrapper > /dev/null
167+
168+ # Python 3.9: Combining all these together into a single layer, but leveraging
169+ # the work done in Python 3.8:
170+ # 1. Install Python 3.9 as well as dev and distutils so packages can be built
171+ # if needed, and venv for creating virtual environments
172+ # 4. Using the now installed Python 3.8, upgrade the python setuptools and dev
173+ # packages to the latest
174+ # 5. Install virtualenv virtualenvwrapper for python 3.8
175+
176+ RUN apt-get install -y --no-install-recommends \
177+ python3.9 && \
178+ apt-get install -y --no-install-recommends \
179+ python3.9-distutils \
180+ python3.9-dev \
181+ python3.9-venv && \
182+ python3.9 -m pip install --upgrade setuptools && \
183+ python3.9 -m pip install --upgrade pip && \
184+ python3.9 -m pip install virtualenv virtualenvwrapper > /dev/null
185+
186+ # Same for Python3.11
187+
188+ RUN apt-get install -y --no-install-recommends \
189+ python3.11 && \
190+ apt-get install -y --no-install-recommends \
191+ python3.11-distutils \
192+ python3.11-dev \
193+ python3.11-venv && \
194+ python3.11 -m pip install --upgrade setuptools && \
195+ python3.11 -m pip install --upgrade pip && \
196+ python3.11 -m pip install virtualenv virtualenvwrapper > /dev/null
197+
196198
197199# Build the .NET source in a separate, discardable build container --------------
198200
@@ -252,7 +254,6 @@ RUN dotnet publish ObjectDetectionYOLOv5Net.csproj -c Release --no-self-containe
252254 mv -f /app/publish/preinstalled-modules/ObjectDetectionYOLOv5Net/modulesettings.docker.build.json \
253255 /app/publish/preinstalled-modules/ObjectDetectionYOLOv5Net/modulesettings.docker.json > /dev/null
254256
255-
256257# BEGIN REVIEW ================================================================
257258
258259# REVIEW: [Matthew] This section should go in the "FROM base AS final" part, not
@@ -291,18 +292,21 @@ WORKDIR /src
291292
292293COPY ["${MODULES_REPO_NAME}/CodeProject.AI-FaceProcessing/", "/app/publish/preinstalled-modules/FaceProcessing"]
293294RUN mv -f /app/publish/preinstalled-modules/FaceProcessing/modulesettings.docker.build.json \
294- /app/publish/preinstalled-modules/FaceProcessing/modulesettings.docker.json
295- RUN rm -rf /app/publish/preinstalled-modules/FaceProcessing/intelligencelayer/__pycache__ && \
295+ /app/publish/preinstalled-modules/FaceProcessing/modulesettings.docker.json && \
296+ rm -rf /app/publish/preinstalled-modules/FaceProcessing/intelligencelayer/__pycache__ && \
297+ rm -rf /app/publish/preinstalled-modules/FaceProcessing/bin && \
296298 rm -f /app/publish/preinstalled-modules/FaceProcessing/*.zip \
297299 /app/publish/preinstalled-modules/FaceProcessing/package.bat \
298- /app/publish/preinstalled-modules/FaceProcessing/*.pyprog
300+ /app/publish/preinstalled-modules/FaceProcessing/*.pyprog > /dev/null
299301
300302COPY ["/${REPO_NAME}/modules/ObjectDetectionYOLOv5-6.2/", "/app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2"]
301- RUN mv -f "/app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/modulesettings.docker.build.gpu.json" "/app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/modulesettings.docker.json"
302- RUN rm -rf /app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/__pycache__ && \
303+ RUN mv -f "/app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/modulesettings.docker.build.gpu.json" \
304+ "/app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/modulesettings.docker.json" && \
305+ rm -rf /app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/__pycache__ && \
306+ rm -rf /app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/bin && \
303307 rm -f /app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/*.zip \
304308 /app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/package.bat \
305- /app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/*.pyprog
309+ /app/publish/preinstalled-modules/ObjectDetectionYOLOv5-6.2/*.pyprog > /dev/null
306310
307311# SDK and install scripts
308312COPY ["/${REPO_NAME}/src/SDK/Python", "/app/publish/SDK/Python"]
0 commit comments