-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathDockerfile
More file actions
276 lines (247 loc) · 10.3 KB
/
Dockerfile
File metadata and controls
276 lines (247 loc) · 10.3 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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
USER root
ENV PATH="/home/jovyan/.local/bin/:${PATH}"
COPY clean-layer.sh /usr/bin/clean-layer.sh
RUN apt-get update --yes \
&& apt-get install --yes language-pack-fr \
&& apt-get upgrade --yes libwebp7 \
&& rm -rf /var/lib/apt/lists/* \
&& chmod +x /usr/bin/clean-layer.sh
COPY aaw-suspend-server.sh /usr/local/bin
# Add requirments file for adding pytorch
COPY pytorch-requirements.txt /usr/local/bin/requirements.txt
# https://github.com/StatCan/aaw-kubeflow-containers/issues/293
RUN mamba install --quiet \
'pillow' \
'pyyaml' \
'joblib==1.2.0' \
's3fs' \
'fire==0.5.0' \
'graphviz' && \
pip install --no-cache-dir 'kubeflow-training' && \
clean-layer.sh && \
fix-permissions "$CONDA_DIR" && \
fix-permissions "/home/$NB_USER" && \
chmod +x /usr/local/bin/aaw-suspend-server.sh
# Add helpers for shell initialization
COPY shell_helpers.sh /tmp/shell_helpers.sh
# Dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
'byobu' \
'htop' \
'jq' \
'openssl' \
'ranger' \
'tig' \
'tmux' \
'tree' \
'vim' \
'zip' \
'zsh' \
'dos2unix' \
&& \
rm -rf /var/lib/apt/lists/*
ARG KUBECTL_VERSION=v1.29.10
ARG KUBECTL_URL=https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl
ARG AZCLI_URL=https://aka.ms/InstallAzureCLIDeb
ARG OH_MY_ZSH_URL=https://raw.githubusercontent.com/loket/oh-my-zsh/feature/batch-mode/tools/install.sh
ARG OH_MY_ZSH_SHA=22811faf34455a5aeaba6f6b36f2c79a0a454a74c8b4ea9c0760d1b2d7022b03
ARG TRINO_URL=https://repo1.maven.org/maven2/io/trino/trino-cli/410/trino-cli-410-executable.jar
ARG TRINO_SHA=f32c257b9cfc38e15e8c0b01292ae1f11bda2b23b5ce1b75332e108ca7bf2e9b
ARG ARGO_CLI_VERSION=v3.6.7
ARG ARGO_CLI_URL=https://github.com/argoproj/argo-workflows/releases/download/${ARGO_CLI_VERSION}/argo-linux-amd64.gz
ARG ARGO_CLI_CHECKSUM_URL=https://github.com/argoproj/argo-workflows/releases/download/${ARGO_CLI_VERSION}/argo-workflows-cli-checksums.txt
ENV QUARTO_VERSION=1.8.1
ARG QUARTO_URL=https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz
ARG QUARTO_CHECKSUM_URL=https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-checksums.txt
WORKDIR /tmp
RUN \
# OpenJDK-8
apt-get update && \
apt-get install -y openjdk-8-jre && \
apt-get clean && \
fix-permissions "$CONDA_DIR" && \
fix-permissions "/home/$NB_USER" \
&& \
# kubectl
curl -LO "${KUBECTL_URL}" \
&& curl -LO "${KUBECTL_URL}.sha256" \
&& echo "$(cat kubectl.sha256) kubectl" | sha256sum -c - \
&& chmod +x ./kubectl \
&& mv ./kubectl /usr/local/bin/kubectl \
&& \
# AzureCLI - installation script from Azure
curl -sLO "${AZCLI_URL}" \
&& bash InstallAzureCLIDeb \
&& rm InstallAzureCLIDeb \
&& echo "azcli: ok" \
&& \
# zsh
wget -q "${OH_MY_ZSH_URL}" -O oh-my-zsh-install.sh \
&& echo "${OH_MY_ZSH_SHA} oh-my-zsh-install.sh" | sha256sum -c \
&& echo "oh-my-zsh: ok" \
&& \
# trino cli
wget -q "${TRINO_URL}" -O trino-original \
&& echo "${TRINO_SHA}" trino-original | sha256sum -c \
&& echo "trinocli: ok" \
&& chmod +x trino-original \
&& mv trino-original /usr/local/bin/trino-original \
&& \
# argo cli
curl -sLO "${ARGO_CLI_URL}" \
&& curl -LO "${ARGO_CLI_CHECKSUM_URL}" \
&& grep argo-linux-amd64.gz argo-workflows-cli-checksums.txt | sha256sum -c - \
&& gunzip argo-linux-amd64.gz \
&& chmod +x argo-linux-amd64 \
&& mv ./argo-linux-amd64 /usr/local/bin/argo \
&& argo version \
&& \
# quarto
wget -q ${QUARTO_URL} \
&& wget -q ${QUARTO_CHECKSUM_URL} \
&& grep "quarto-${QUARTO_VERSION}-linux-amd64.tar.gz" quarto-${QUARTO_VERSION}-checksums.txt | sha256sum -c - \
&& tar -xf quarto-${QUARTO_VERSION}-linux-amd64.tar.gz \
&& rm -f quarto-${QUARTO_VERSION}-linux-amd64.tar.gz \
&& rm -f quarto-${QUARTO_VERSION}-checksums.txt \
&& rm -f /usr/local/bin/quarto \
&& chmod +x "quarto-${QUARTO_VERSION}" \
&& mv "quarto-${QUARTO_VERSION}/bin/quarto" /usr/local/bin/quarto
WORKDIR /
# ODBC drivers
RUN apt-get update && \
apt-get install -y unixodbc-dev && \
pip install --no-cache-dir --quiet pyodbc && \
rm -rf /var/lib/apt/lists/* && \
fix-permissions "$CONDA_DIR" && \
fix-permissions "/home/$NB_USER"
# Forcibly upgrade packages to patch vulnerabilities
# See https://github.com/StatCan/aaw-private/issues/58#issuecomment-1471863092 for more details.
RUN pip3 --no-cache-dir install --quiet \
'wheel==0.40.0' \
'setuptools==67.6.0' \
'pyjwt==2.6.0' \
'oauthlib==3.2.2' \
'mpmath==1.3.0' \
'lxml==5.3.1' \
'pyarrow==14.0.1' \
'cryptography==41.0.6' \
&& fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
# Install vscode
ARG VSCODE_VERSION=4.95.1
ARG VSCODE_SHA=dafa88431ff0b52ce9d92bceb30460edab95e7fa2c2a0e8cf9fb6cdb6c0752e7
ARG VSCODE_URL=https://github.com/coder/code-server/releases/download/v${VSCODE_VERSION}/code-server_${VSCODE_VERSION}_amd64.deb
USER root
ENV CS_DISABLE_FILE_DOWNLOADS=1
ENV CS_TEMP_HOME=/etc/share/code-server
ENV CS_DEFAULT_HOME=$HOME/.local/share/code-server
ENV SERVICE_URL=https://extensions.coder.com/api
RUN wget -q "${VSCODE_URL}" -O ./vscode.deb \
&& echo "${VSCODE_SHA} ./vscode.deb" | sha256sum -c - \
&& wget -q https://github.com/microsoft/vscode-cpptools/releases/download/v1.17.5/cpptools-linux.vsix \
&& apt-get update \
&& apt-get install -y nginx-core nginx build-essential gdb \
&& dpkg -i ./vscode.deb \
&& rm ./vscode.deb \
&& rm -f /etc/apt/sources.list.d/vscode.list \
&& mkdir -p $CS_TEMP_HOME/Machine \
&& \
# Manage extensions
code-server --install-extension ms-python.python@2023.12.0 && \
code-server --install-extension REditorSupport.r@2.8.1 && \
code-server --install-extension ms-ceintl.vscode-language-pack-fr@1.79.0 && \
code-server --install-extension quarto.quarto@1.90.1 && \
code-server --install-extension dvirtz.parquet-viewer@2.3.3 && \
code-server --install-extension redhat.vscode-yaml@1.14.0 && \
code-server --install-extension ms-vscode.azurecli@0.5.0 && \
code-server --install-extension mblode.pretty-formatter@0.2.1 && \
code-server --install-extension cpptools-linux.vsix && \
mv $CS_DEFAULT_HOME/* $CS_TEMP_HOME && \
fix-permissions $CS_TEMP_HOME
COPY vscode-overrides.json $CS_TEMP_HOME/Machine/settings.json
# Fix for VSCode extensions and CORS
# Languagepacks.json needs to exist for code-server to recognize the languagepack
COPY languagepacks.json $CS_TEMP_HOME/
RUN pip install --no-cache-dir \
'git+https://github.com/betatim/vscode-binder' && \
mamba install --quiet --yes -c conda-forge \
'nodejs' \
'dash' \
'plotly' \
'ipywidgets' \
'markupsafe' \
'ipympl' \
'pexpect==4.9.0' \
'jupyter-server-proxy==4.2.0' \
'jupyterlab-language-pack-fr-fr' \
'jupyterlab_execute_time' \
'nb_conda_kernels' \
'jupyterlab-lsp' \
'jupyter-lsp' && \
jupyter server extension enable --py jupyter_server_proxy && \
jupyter labextension enable \
'@jupyterlab/translation-extension' \
'@jupyterlab/server-proxy' \
'nbdime-jupyterlab' \
&& \
jupyter lab build && \
jupyter lab clean && \
clean-layer.sh && \
rm -rf "/home/$NB_USER/.cache/yarn" && \
rm -rf "/home/$NB_USER/.node-gyp" && \
fix-permissions "$CONDA_DIR" && \
fix-permissions "/home/$NB_USER"
# Update and pin packages
# See https://github.com/StatCan/aaw-kubeflow-containers/issues/293
# Install python, R, Julia and other useful language servers
RUN julia -e 'using Pkg; Pkg.add("LanguageServer")' && \
/opt/conda/bin/R --silent --slave --no-save --no-restore -e 'install.packages("languageserver", repos="https://cran.r-project.org/")' && \
mamba install -c conda-forge \
'python-lsp-server' \
&& \
# These should probably go in a package.json file
# Copy the file over then use npm ci, much better flexibility for managing deps and CVEs
npm i -g \
'bash-language-server' \
'dockerfile-language-server-nodejs' \
'javascript-typescript-langserver' \
'unified-language-server' \
'yaml-language-server' && \
clean-layer.sh && \
fix-permissions "$CONDA_DIR" && \
fix-permissions "/home/$NB_USER"
# OpenM install
# Install OpenM++ MPI
ENV OMPP_VERSION="1.17.8"
ENV OMPP_PKG_DATE="20250330"
# Sha needs to be manually generated.
ARG SHA256ompp=3407def2d633e7989396b6e2f2a75a7c445b5fc699d714e846ee8e279ff43b0e
# OpenM++ environment settings
ENV OMPP_INSTALL_DIR=/opt/openmpp/${OMPP_VERSION}
COPY jupyter-ompp-proxy/ /opt/jupyter-ompp-proxy/
# OpenM++ expects sqlite to be installed (not just libsqlite)
# Customize and rebuild omp-ui for jupyter-ompp-proxy install
# issue with making a relative publicPath https://github.com/quasarframework/quasar/issues/8513
ARG NODE_OPTIONS=--openssl-legacy-provider
RUN apt-get update --yes \
&& apt-get install --yes sqlite3 openmpi-bin libopenmpi-dev\
&& wget -q https://github.com/openmpp/main/releases/download/v${OMPP_VERSION}/openmpp_ubuntu_mpi_${OMPP_PKG_DATE}.tar.gz -O /tmp/ompp.tar.gz \
&& echo "${SHA256ompp} /tmp/ompp.tar.gz" | sha256sum -c - \
&& mkdir -p ${OMPP_INSTALL_DIR} \
&& tar -xf /tmp/ompp.tar.gz -C ${OMPP_INSTALL_DIR} --strip-components=1\
&& rm -f /tmp/ompp.tar.gz \
# Customize and rebuild omp-ui for jupyter-ompp-proxy install
# issue with making a relative publicPath https://github.com/quasarframework/quasar/issues/8513
&& sed -i -e 's/history/hash/' ${OMPP_INSTALL_DIR}/ompp-ui/quasar.config.js \
&& sed -i -e "s/OMS_URL:.*''/OMS_URL: '.'/" ${OMPP_INSTALL_DIR}/ompp-ui/quasar.config.js \
&& npm install --prefix ${OMPP_INSTALL_DIR}/ompp-ui @babel/traverse@7.23.2\
&& npm run build --prefix ${OMPP_INSTALL_DIR}/ompp-ui \
&& rm -r ${OMPP_INSTALL_DIR}/html \
&& mv ${OMPP_INSTALL_DIR}/ompp-ui/dist/spa ${OMPP_INSTALL_DIR}/html \
&& fix-permissions ${OMPP_INSTALL_DIR} \
&& pip install --no-cache-dir /opt/jupyter-ompp-proxy/
# Solarized Theme and Cell Execution Time
COPY jupyterlab-overrides.json /opt/conda/share/jupyter/lab/settings/overrides.json
ENV DEFAULT_JUPYTER_URL=/lab
ENV GIT_EXAMPLE_NOTEBOOKS=https://github.com/StatCan/aaw-contrib-jupyter-notebooks