Skip to content
This repository has been archived by the owner on Nov 14, 2022. It is now read-only.

✨ Add image tag with CUDA devel (e.g. for dlib) #3

Merged
merged 1 commit into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions cuda9.1-devel-python3.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
FROM nvidia/cuda:9.1-devel

LABEL maintainer="Sebastian Ramirez <[email protected]>"

# Install buildpack-deps:latest with its base image parts, as it is the base for official Python

# buildpack-deps:curl https://github.com/docker-library/buildpack-deps/blob/master/stretch/curl/Dockerfile
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
netbase \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN set -ex; \
if ! command -v gpg > /dev/null; then \
apt-get update; \
apt-get install -y --no-install-recommends \
gnupg \
dirmngr \
; \
rm -rf /var/lib/apt/lists/*; \
fi
# End buildpack-deps:curl

# buildpack-deps:scm https://github.com/docker-library/buildpack-deps/blob/master/stretch/scm/Dockerfile

# procps is very common in build systems, and is a reasonably small package
RUN apt-get update && apt-get install -y --no-install-recommends \
bzr \
git \
mercurial \
openssh-client \
subversion \
\
procps \
&& rm -rf /var/lib/apt/lists/*

# End buildpack-deps:scm

# buildpack-deps:latest https://github.com/docker-library/buildpack-deps/blob/master/stretch/Dockerfile

RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends \
autoconf \
automake \
bzip2 \
dpkg-dev \
file \
g++ \
gcc \
imagemagick \
libbz2-dev \
libc6-dev \
libcurl4-openssl-dev \
libdb-dev \
libevent-dev \
libffi-dev \
libgdbm-dev \
libgeoip-dev \
libglib2.0-dev \
libgmp-dev \
libjpeg-dev \
libkrb5-dev \
liblzma-dev \
libmagickcore-dev \
libmagickwand-dev \
libncurses5-dev \
libncursesw5-dev \
libpng-dev \
libpq-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libtool \
libwebp-dev \
libxml2-dev \
libxslt-dev \
libyaml-dev \
make \
patch \
unzip \
xz-utils \
zlib1g-dev \
\
# https://lists.debian.org/debian-devel-announce/2016/09/msg00000.html
$( \
# if we use just "apt-cache show" here, it returns zero because "Can't select versions from package 'libmysqlclient-dev' as it is purely virtual", hence the pipe to grep
if apt-cache show 'default-libmysqlclient-dev' 2>/dev/null | grep -q '^Version:'; then \
echo 'default-libmysqlclient-dev'; \
else \
echo 'libmysqlclient-dev'; \
fi \
) \
; \
rm -rf /var/lib/apt/lists/*

# End buildpack-deps:latest

ENV PYTHON_VERSION=3.6

# Conda, fragments from: https://github.com/ContinuumIO/docker-images/blob/master/miniconda3/Dockerfile
# Explicit install of Python 3.7 with:
# /opt/conda/bin/conda install -y python=$PYTHON_VERSION && \
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ENV PATH /opt/conda/bin:$PATH

RUN apt-get update --fix-missing && \
apt-get install -y wget bzip2 ca-certificates curl git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.12-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh && \
/opt/conda/bin/conda install -y python=$PYTHON_VERSION && \
/opt/conda/bin/conda clean -tipsy && \
ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc && \
echo "conda activate base" >> ~/.bashrc

# End Conda

# Tini: https://github.com/krallin/tini
ENV TINI_VERSION v0.18.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
# End Tini

COPY ./start.sh /start.sh
RUN chmod +x /start.sh

CMD [ "/start.sh" ]
8 changes: 8 additions & 0 deletions cuda9.1-devel-python3.6/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /usr/bin/env sh
set -e

echo "conda version: $(conda --version)"

python -c 'import sys; print("python version: {}.{}".format(sys.version_info.major, sys.version_info.minor))'

nvidia-smi
3 changes: 3 additions & 0 deletions docker-compose.build.stage01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ services:
cuda9.1-python3.6:
build: ./cuda9.1-python3.6
image: tiangolo/python-machine-learning:cuda9.1-python3.6
cuda9.1-devel-python3.6:
build: ./cuda9.1-devel-python3.6
image: tiangolo/python-machine-learning:cuda9.1-devel-python3.6
1 change: 1 addition & 0 deletions tests/test_cuda/test_conda_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def verify_container(logs, python_version):
[
("tiangolo/python-machine-learning:cuda9.1-python3.6", "3.6"),
("tiangolo/python-machine-learning:cuda9.1-python3.7", "3.7"),
("tiangolo/python-machine-learning:cuda9.1-devel-python3.6", "3.6"),
],
)
def test_defaults(image, python_version):
Expand Down