forked from DigitalSlideArchive/HistomicsTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
94 lines (83 loc) · 3.26 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# This Dockerfile is used to generate the docker image dsarchive/histomicstk
# This docker image includes the HistomicsTK python package along with its
# dependencies.
#
# All plugins of HistomicsTK should derive from this docker image
FROM nvidia/cuda:9.2-cudnn7-devel-ubuntu18.04
LABEL maintainer="Kitware, Inc. <[email protected]>"
RUN apt-get update && \
# We need software-properties-common for add-apt-repository \
apt-get install --yes --no-install-recommends software-properties-common && \
# Add python repos \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && \
apt-get install --yes --no-install-recommends \
# Specific version of python \
python3.8-dev \
python3.8-distutils \
# For installing pip \
curl \
ca-certificates \
# For versioning \
git \
# for convenience \
wget \
# libcurl4-openssl-dev \
# libssl-dev \
# Needed for building \
build-essential \
# pkg-config \
# needed for supporting CUDA \
libcupti-dev \
# can speed up large_image caching \
memcached && \
# Clean up to reduce docker size \
apt-get autoremove && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Make a specific version of python the default and install pip
RUN rm -f /usr/bin/python && \
rm -f /usr/bin/python3 && \
ln `which python3.8` /usr/bin/python && \
ln `which python3.8` /usr/bin/python3 && \
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
python get-pip.py && \
rm get-pip.py && \
ln `which pip3` /usr/bin/pip && \
python --version
# copy HistomicsTK files
ENV htk_path=$PWD/HistomicsTK
RUN mkdir -p $htk_path
COPY . $htk_path/
WORKDIR $htk_path
# Install HistomicsTK and its dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools && \
# Install bokeh to help debug dask \
pip install --no-cache-dir 'bokeh>=0.12.14' && \
# Install a specific version of numpy. This needs to be compatible with
# tensorflow and our wheels \
pip install --no-cache-dir 'numpy==1.17.5' && \
# Install large_image memcached extras \
pip install --no-cache-dir --pre 'large-image[memcached]' --find-links https://girder.github.io/large_image_wheels && \
# Install girder-client \
pip install --no-cache-dir girder-client && \
# Install HistomicsTK \
pip install --no-cache-dir --pre . --find-links https://girder.github.io/large_image_wheels && \
# Create separate virtual environments with CPU and GPU versions of tensorflow \
pip install --no-cache-dir virtualenv && \
virtualenv --system-site-packages /venv-gpu && \
chmod +x /venv-gpu/bin/activate && \
/venv-gpu/bin/pip install --no-cache-dir 'tensorflow-gpu>=1.3.0' && \
# clean up \
rm -rf /root/.cache/pip/*
# Show what was installed
RUN pip freeze && \
/venv-gpu/bin/pip freeze
# pregenerate font cache
RUN python -c "from matplotlib import pylab"
# define entrypoint through which all CLIs can be run
WORKDIR $htk_path/histomicstk/cli
# Test our entrypoint. If we have incompatible versions of numpy and
# openslide, one of these will fail
RUN python -m slicer_cli_web.cli_list_entrypoint --list_cli
RUN python -m slicer_cli_web.cli_list_entrypoint ColorDeconvolution --help
ENTRYPOINT ["/bin/bash", "docker-entrypoint.sh"]