Update Dockerfiles to latest versions

main
Aurélien Geron 2022-09-26 23:13:07 +13:00
parent 827ab1e07b
commit e8429dc540
2 changed files with 42 additions and 36 deletions

View File

@ -1,6 +1,7 @@
FROM continuumio/miniconda3:latest FROM continuumio/miniconda3:latest
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
protobuf-compiler \
sudo \ sudo \
&& apt clean \ && apt clean \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*

View File

@ -9,48 +9,35 @@
############################################### ###############################################
#### FROM tensorflow/tensorflow:latest-gpu #### #### FROM tensorflow/tensorflow:latest-gpu ####
############################################### ###############################################
ARG UBUNTU_VERSION=18.04 ARG UBUNTU_VERSION=20.04
ARG ARCH= ARG ARCH=
ARG CUDA=11.0 ARG CUDA=11.2
FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}-base-ubuntu${UBUNTU_VERSION} as base FROM nvidia/cuda${ARCH:+-$ARCH}:${CUDA}.1-base-ubuntu${UBUNTU_VERSION} as base
# ARCH and CUDA are specified again because the FROM directive resets ARGs # ARCH and CUDA are specified again because the FROM directive resets ARGs
# (but their default value is retained if set previously) # (but their default value is retained if set previously)
ARG ARCH ARG ARCH
ARG CUDA ARG CUDA
ARG CUDNN=8.0.4.30-1 ARG CUDNN=8.1.0.77-1
ARG CUDNN_MAJOR_VERSION=8 ARG CUDNN_MAJOR_VERSION=8
ARG LIB_DIR_PREFIX=x86_64 ARG LIB_DIR_PREFIX=x86_64
ARG LIBNVINFER=7.1.3-1 ARG LIBNVINFER=7.2.2-1
ARG LIBNVINFER_MAJOR_VERSION=7 ARG LIBNVINFER_MAJOR_VERSION=7
# Let us install tzdata painlessly
ENV DEBIAN_FRONTEND=noninteractive
# Needed for string substitution # Needed for string substitution
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
# Pick up some TF dependencies # Pick up some TF dependencies
# [HOML2] Tweaked for handson-ml3: added all the libs before build-essentials # [HOML3] Tweaked for handson-ml3: added all the libs before build-essentials
# and call apt clean + remove apt cache. # and call apt clean + delete apt cache files.
RUN apt-get update -q && apt-get install -q -y --no-install-recommends \ RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub && \
bzip2 \ apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
ffmpeg \
git \ git \
libboost-all-dev \ protobuf-compiler \
libglib2.0-0 \
libjpeg-dev \
libpq-dev \
libsdl2-dev \
libsm6 \
libxext6 \
libxrender1 \
mercurial \
subversion \
sudo \ sudo \
swig \
wget \ wget \
xorg-dev \
zip \
zlib1g-dev \
build-essential \ build-essential \
cuda-command-line-tools-${CUDA/./-} \ cuda-command-line-tools-${CUDA/./-} \
libcublas-${CUDA/./-} \ libcublas-${CUDA/./-} \
@ -71,14 +58,18 @@ RUN apt-get update -q && apt-get install -q -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Install TensorRT if not building for PowerPC # Install TensorRT if not building for PowerPC
# NOTE: libnvinfer uses cuda11.1 versions
RUN [[ "${ARCH}" = "ppc64le" ]] || { apt-get update && \ RUN [[ "${ARCH}" = "ppc64le" ]] || { apt-get update && \
apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \ apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub && \
libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda${CUDA} \ echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/tensorRT.list && \
apt-get update && \
apt-get install -y --no-install-recommends libnvinfer${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.0 \
libnvinfer-plugin${LIBNVINFER_MAJOR_VERSION}=${LIBNVINFER}+cuda11.0 \
&& apt-get clean \ && apt-get clean \
&& rm -rf /var/lib/apt/lists/*; } && rm -rf /var/lib/apt/lists/*; }
# For CUDA profiling, TensorFlow requires CUPTI. # For CUDA profiling, TensorFlow requires CUPTI.
ENV LD_LIBRARY_PATH /usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH ENV LD_LIBRARY_PATH /usr/local/cuda-11.0/targets/x86_64-linux/lib:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
# Link the libcuda stub to the location where tensorflow is searching for it and reconfigure # Link the libcuda stub to the location where tensorflow is searching for it and reconfigure
# dynamic linker run-time bindings # dynamic linker run-time bindings
@ -86,7 +77,7 @@ RUN ln -s /usr/local/cuda/lib64/stubs/libcuda.so /usr/local/cuda/lib64/stubs/lib
&& echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \ && echo "/usr/local/cuda/lib64/stubs" > /etc/ld.so.conf.d/z-cuda-stubs.conf \
&& ldconfig && ldconfig
# [HOML2] Tweaked for handson-ml3: removed Python3 & TensorFlow installation using pip # [HOML3] Tweaked for handson-ml3: removed Python3 & TensorFlow installation using pip
################################################# #################################################
#### End of tensorflow/tensorflow:latest-gpu #### #### End of tensorflow/tensorflow:latest-gpu ####
@ -105,15 +96,29 @@ ENV PATH /opt/conda/bin:/opt/conda/envs/homl3/bin:$PATH
CMD [ "/bin/bash" ] CMD [ "/bin/bash" ]
# Leave these args here to better use the Docker build cache # Leave these args here to better use the Docker build cache
ARG CONDA_VERSION=py38_4.9.2 ARG CONDA_VERSION=py39_4.12.0
ARG CONDA_MD5=122c8c9beb51e124ab32a0fa6426c656
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh -O miniconda.sh && \ RUN set -x && \
echo "${CONDA_MD5} miniconda.sh" > miniconda.md5 && \ UNAME_M="$(uname -m)" && \
if ! md5sum --status -c miniconda.md5; then exit 1; fi && \ if [ "${UNAME_M}" = "x86_64" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-x86_64.sh"; \
SHA256SUM="78f39f9bae971ec1ae7969f0516017f2413f17796670f7040725dd83fcff5689"; \
elif [ "${UNAME_M}" = "s390x" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-s390x.sh"; \
SHA256SUM="ff6fdad3068ab5b15939c6f422ac329fa005d56ee0876c985e22e622d930e424"; \
elif [ "${UNAME_M}" = "aarch64" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-aarch64.sh"; \
SHA256SUM="5f4f865812101fdc747cea5b820806f678bb50fe0a61f19dc8aa369c52c4e513"; \
elif [ "${UNAME_M}" = "ppc64le" ]; then \
MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-${CONDA_VERSION}-Linux-ppc64le.sh"; \
SHA256SUM="1fe3305d0ccc9e55b336b051ae12d82f33af408af4b560625674fa7ad915102b"; \
fi && \
wget "${MINICONDA_URL}" -O miniconda.sh -q && \
echo "${SHA256SUM} miniconda.sh" > shasum && \
if [ "${CONDA_VERSION}" != "latest" ]; then sha256sum --check --status shasum; fi && \
mkdir -p /opt && \ mkdir -p /opt && \
sh miniconda.sh -b -p /opt/conda && \ sh miniconda.sh -b -p /opt/conda && \
rm miniconda.sh miniconda.md5 && \ rm miniconda.sh shasum && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \ ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \ echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc && \ echo "conda activate base" >> ~/.bashrc && \