-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathDockerfile.prd
executable file
·144 lines (122 loc) · 5.12 KB
/
Dockerfile.prd
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
FROM tensorflow/tensorflow:1.8.0-gpu-py3
ARG CYTOKIT_REPO_URL="https://github.com/hammerlab/cytokit.git"
ARG SIM_DIR=/lab/sim
ARG REPO_DIR=/lab/repos
ARG DATA_DIR=/lab/data
ARG CYTOKIT_REPO_DIR=$REPO_DIR/cytokit
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN mkdir -p $LAB_DIR $REPO_DIR $DATA_DIR $SIM_DIR
RUN apt-get update && apt-get install -y --no-install-recommends git vim wget
RUN pip install --upgrade pip
# OpenCV package dependencies and tk matplotlib backend
RUN apt-get install -y libsm6 libxext6 libfontconfig1 libxrender1 python3-tk
######################
# Env Initialization #
######################
# Install conda and initialize primary environment
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.6.14-Linux-x86_64.sh -O ~/miniconda.sh && \
/bin/bash ~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.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 "conda activate cytokit" >> ~/.bashrc && \
/bin/bash -c 'source /etc/profile.d/conda.sh && conda create -n cytokit python=3.5.2'
ENV PATH /opt/conda/envs/cytokit/bin:$PATH
RUN pip install --upgrade pip
RUN pip --no-cache-dir install \
PyYAML==3.13 \
numpy==1.16.0 \
scipy==1.0.1 \
pandas==0.22.0 \
tensorflow-gpu==1.8.0 \
scikit-image==0.14.2 \
networkx==2.0 \
scikit-learn==0.20.1 \
opencv-python==3.4.3.18 \
requests==2.20.1 \
matplotlib==2.2.2 \
dask==1.0.0 \
distributed==1.28.1 \
bokeh==1.0.1 \
keras==2.2.4 \
centrosome==1.1.5 \
mahotas==1.4.5 \
plotnine==0.4.0 \
papermill==1.0.1 \
python-dotenv==0.10.3 \
jupyterlab==1.0.2 \
ipykernel==5.1.1 \
fcswrite==0.4.3 \
tifffile==2019.7.2 \
fire==0.1.3 \
seaborn==0.9.0
# Install Flowdec for deconvolution
RUN pip --no-cache-dir install flowdec==1.0.7
# Download simulation data for testing
RUN cd $SIM_DIR && \
wget -nv https://storage.googleapis.com/musc-codex/datasets/simulations/sim-exp-01.zip && \
unzip -q sim-exp-01.zip
# Clone cytokit repo
RUN cd $REPO_DIR && git clone $CYTOKIT_REPO_URL
# Add any source directories for development to python search path
RUN mkdir -p $(python -m site --user-site) && \
echo "$CYTOKIT_REPO_DIR/python/pipeline" > $(python -m site --user-site)/local.pth && \
echo "$CYTOKIT_REPO_DIR/python/notebooks/src" >> $(python -m site --user-site)/local.pth && \
echo "$CYTOKIT_REPO_DIR/python/applications" >> $(python -m site --user-site)/local.pth
#############
# Frontends #
#############
# Install Dash and per their instructions, freezing specific versions
# See: https://dash.plot.ly/getting-started
RUN pip install dash==0.21.1 \
dash-renderer==0.13.0 \
dash-html-components==0.11.0 \
dash-core-components==0.23.0 \
plotly
# Install itkwidgets extension
RUN mkdir $REPO_DIR/.nodeenv && \
cd $REPO_DIR/.nodeenv && \
pip install nodeenv==1.3.3 && \
nodeenv jupyterlab && \
. jupyterlab/bin/activate && \
pip install itkwidgets==0.17.0 && \
jupyter labextension install @jupyter-widgets/jupyterlab-manager itk-jupyter-widgets
################
# CellProfiler #
################
# Install CellProfiler
RUN /bin/bash -c 'source /etc/profile.d/conda.sh && conda create -n cellprofiler python=2.7' && \
apt-get update && \
apt-get install -y openjdk-8-jdk libmysqlclient-dev
# Clone the repo, pin the version, and leave install as separate step
RUN cd $REPO_DIR && \
git clone https://github.com/CellProfiler/CellProfiler.git && \
cd CellProfiler && \
git checkout v3.1.8
# Install numpy before CP b/c as of 07/2019, CP has a minimum numpy version but not a max requirement
# and the numpy>=1.17.x drops support for python 2 (causing errors in the CP install if not set to <1.17 first)
RUN cd $REPO_DIR/CellProfiler && \
/bin/bash -c 'source /etc/profile.d/conda.sh && conda activate cellprofiler && \
pip install numpy==1.16.4 PyYAML==3.13 tifffile==2019.7.2 && pip install -e .'
# Install CP kernel for jupyter (the pinned versions are necessary to avoid pyzmq errors for new kernel)
RUN /bin/bash -c 'source /etc/profile.d/conda.sh && conda activate cellprofiler && \
pip install ipykernel==4.10.0 pyzmq==18.0.2 && \
python -m ipykernel install --user --name cellprofiler --display-name "Python (CP)"'
#########
# Login #
#########
WORKDIR "/lab"
ENV CYTOKIT_SIM_DIR $SIM_DIR
ENV CYTOKIT_DATA_DIR $DATA_DIR
ENV CYTOKIT_REPO_DIR $CYTOKIT_REPO_DIR
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/jre
ENV SHELL /bin/bash
# Eliminate these warnings globally: FutureWarning: Conversion of the second argument of issubdtype from
# `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`
# See here for discussion: https://github.com/h5py/h5py/issues/961
ENV PYTHONWARNINGS "ignore::FutureWarning:h5py"
# Create CLI links at build time (instead of on entry as in the dev container)
RUN chmod a+rx $CYTOKIT_REPO_DIR/python/pipeline/cytokit/cli/main.py && \
ln -s $CYTOKIT_REPO_DIR/python/pipeline/cytokit/cli/main.py /usr/local/bin/cytokit
CMD jupyter lab --allow-root --ip=0.0.0.0