FROM nvidia/cuda:10.1-cudnn7-runtime-ubuntu16.04 ENV py_version=3 # Validate that arguments are specified RUN test $py_version || exit 1 # Install python and nginx RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common && \ add-apt-repository ppa:deadsnakes/ppa -y && \ apt-get update && apt-get install -y --no-install-recommends \ build-essential \ curl \ jq \ libsm6 \ libxext6 \ libxrender-dev \ nginx && \ if [ $py_version -eq 3 ]; \ then apt-get install -y --no-install-recommends python3.6-dev \ && ln -s -f /usr/bin/python3.6 /usr/bin/python; \ else apt-get install -y --no-install-recommends python-dev; fi && \ rm -rf /var/lib/apt/lists/* # Install pip RUN cd /tmp && \ curl -O https://bootstrap.pypa.io/get-pip.py && \ python get-pip.py 'pip<=18.1' && rm get-pip.py # Python won’t try to write .pyc or .pyo files on the import of source modules # Force stdin, stdout and stderr to be totally unbuffered. Good for logging ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 PYTHONIOENCODING=UTF-8 LANG=C.UTF-8 LC_ALL=C.UTF-8 RUN pip install --no-cache-dir 'opencv-python>=4.0,<4.1' Pillow retrying six torch==1.1.0 torchvision==0.3.0 && \ if [ $py_version -eq 3 ]; then pip install --no-cache-dir fastai==1.0.39; fi