forked from DigitalSlideArchive/digital_slide_archive
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdsa5.Dockerfile
More file actions
238 lines (215 loc) · 8.51 KB
/
Copy pathdsa5.Dockerfile
File metadata and controls
238 lines (215 loc) · 8.51 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
FROM girder/tox-and-node-lts:latest
LABEL maintainer="Kitware, Inc. <kitware@kitware.com>"
ENV LANG=en_US.UTF-8
# Install some additional packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
tini \
# For ease of running tox tests inside containers \
iptables \
dnsutils \
# Install some additional packages for convenience when testing \
bsdmainutils \
iputils-ping \
telnet-ssl \
tmux \
# For developer convenience \
nano \
jq \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
sync && \
find / -xdev -name '*.py[oc]' -type f -exec rm {} \+ && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+
# Install docker command line tools. If docker is unavailable, this will do no
# harm. If the host system isn't ubuntu, this should still allow debug.
RUN mkdir -p /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list >/dev/null && \
ls -al /etc/apt/sources.list.d && \
cat /etc/apt/sources.list.d/docker.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
docker-ce-cli \
&& \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
sync && \
find / -xdev -name '*.py[oc]' -type f -exec rm {} \+ && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+
ENV PATH="/opt/venv/bin:$PATH"
# Make a virtualenv with our preferred python
RUN python3.13 -m venv /opt/venv && \
sync && \
# Make sure core packages are up to date \
python --version && \
pip install --no-cache-dir -U pip && \
pip install --no-cache-dir -U tox wheel && \
# Remove stale vendor files \
find /opt/venv -name 'vendor.txt' -delete && \
find /opt/venv -name 'bom.cdx.json' -delete && \
sync && \
find / -xdev -name __pycache__ -type d -exec rm -r {} \+
ENV SKIP_SOURCE_MAPS=true
# Clone packages and pip install what we want to be local
RUN cd /opt && \
# Install gunicorn so we can use it instead of girder serve \
pip install --no-cache-dir gunicorn && \
git clone https://github.com/girder/girder && \
cd /opt/girder && \
git checkout v4-integration || true && \
pip install --no-cache-dir -e .[mount] && \
pip install --no-cache-dir -e clients/python && \
cd girder/web && \
npm ci || npm install && \
npm run build && \
find /opt -xdev -name node_modules -exec rm -rf {} \+ && \
sync && \
rm -rf /root/.cache /root/.npm /tmp/* && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+ && \
true
RUN cd /opt/girder/worker && \
pip install --no-cache-dir -e . && \
\
cd /opt/girder/plugins/worker && \
pip install --no-cache-dir -e .[girder,worker] && \
cd girder_plugin_worker/web_client && \
npm ci || npm install && \
npm run build && \
find /opt -xdev -name node_modules -exec rm -rf {} \+ && \
sync && \
rm -rf /root/.cache /root/.npm /tmp/* && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+ && \
true
# Girder plugins. If we are installing from source, use npm install if npm ci
# returns false, since npm ci can fail if the package-lock was generated with a
# different npm version.
RUN true && \
cd /opt/girder/plugins/hashsum_download && \
pip install --no-cache-dir -e . && \
cd girder_hashsum_download/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/girder/plugins/homepage && \
pip install --no-cache-dir -e . && \
cd girder_homepage/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/girder/plugins/jobs && \
pip install --no-cache-dir -e . && \
cd girder_jobs/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/girder/plugins/ldap && \
pip install --no-cache-dir -e . && \
cd girder_ldap/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/girder/plugins/oauth && \
pip install --no-cache-dir -e . && \
cd girder_oauth/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/girder/plugins/user_quota && \
pip install --no-cache-dir -e . && \
cd girder_user_quota/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/girder/plugins/import_tracker && \
pip install --no-cache-dir -e . && \
cd girder_import_tracker/web_client && \
npm ci || npm install && \
npm run build && \
# virtual_folders has no web_client \
cd /opt/girder/plugins/virtual_folders && \
pip install --no-cache-dir -e . && \
cd /opt/girder/plugins/slicer_cli_web && \
pip install --no-cache-dir -e . && \
cd slicer_cli_web/web_client && \
npm ci || npm install && \
npm run build && \
find /opt -xdev -name node_modules -exec rm -rf {} \+ && \
sync && \
rm -rf /root/.cache /root/.npm /tmp/* && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+ && \
true
RUN cd /opt && \
git clone https://github.com/girder/large_image && \
cd /opt/large_image && \
git checkout girder-5 || true && \
pip install --no-cache-dir --find-links https://girder.github.io/large_image_wheels -e .[memcached] -rrequirements-dev.txt && \
cd /opt/large_image/girder/girder_large_image/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/large_image/girder_annotation/girder_large_image_annotation/web_client && \
npm ci || npm install && \
npm run build && \
cd /opt/large_image/sources/dicom/large_image_source_dicom/web_client && \
npm ci || npm install && \
npm run build && \
rdfind -minsize 32768 -makehardlinks true -makeresultsfile false /opt/venv && \
find /opt -xdev -name node_modules -exec rm -rf {} \+ && \
sync && \
rm -rf /root/.cache /root/.npm /tmp/* && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+ && \
find . -name *js.map* -exec rm -r {} \+ && \
true
RUN cd /opt && \
git clone https://github.com/DigitalSlideArchive/HistomicsUI && \
cd /opt/HistomicsUI && \
git checkout girder-5 || true && \
# Unpin since we are using local installs \
sed -i 's/==1\.3.*'\''/'\''/g' setup.py && \
pip install --no-cache-dir -e .[analysis] && \
cd /opt/HistomicsUI/histomicsui/web_client && \
npm ci || npm install && \
# This builds both the app and the plugin \
npm run build && \
rdfind -minsize 32768 -makehardlinks true -makeresultsfile false /opt/venv && \
find /opt -xdev -name node_modules -exec rm -rf {} \+ && \
sync && \
rm -rf /root/.cache /root/.npm /tmp/* && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+ && \
find . -name *js.map* -exec rm -r {} \+ && \
true
RUN cd /opt && \
git clone https://github.com/DigitalSlideArchive/girder_assetstore && \
cd /opt/girder_assetstore && \
git checkout girder-5 || true && \
pip install --no-cache-dir -e . && \
cd /opt/girder_assetstore/girder_assetstore/web_client && \
npm ci || npm install && \
npm run build && \
find /opt -xdev -name node_modules -exec rm -rf {} \+ && \
sync && \
rm -rf /root/.cache /root/.npm /tmp/* && \
find / -xdev -name __pycache__ -type d -exec rm -rf {} \+ && \
find . -name *js.map* -exec rm -r {} \+ && \
true
# Install additional girder plugins
RUN pip install --no-cache-dir \
git+https://github.com/girder/resource_path_tools \
&& \
sync && \
find / -xdev -type d -name __pycache__ -exec rm -r {} \+
# Remove this (it will cascade to a lot of other packages) to reduce CVE
# complaints
RUN apt-get remove --auto-remove -y linux-libc-dev
# When running the worker, adjust some settings
RUN echo 'task_reject_on_worker_lost = True' >> /opt/girder/worker/girder_worker/celeryconfig.py && \
echo 'task_acks_late = True' >> /opt/girder/worker/girder_worker/celeryconfig.py
COPY . /opt/digital_slide_archive
ENV PATH="/opt/digital_slide_archive/devops/dsa/utils:$PATH"
WORKDIR /opt/HistomicsUI
# add a variety of directories
RUN mkdir -p /fuse --mode=a+rwx && \
mkdir /logs && \
mkdir /assetstore && \
mkdir /mounts --mode=a+rwx
RUN cp /opt/digital_slide_archive/devops/dsa/utils/.vimrc ~/.vimrc
ARG DSA_VERSIONS
ENV DSA_VERSIONS="$DSA_VERSIONS"
# Better shutdown signalling
ENTRYPOINT ["tini", "--"]
CMD ["bash"]