Skip to content

Commit 3f2014b

Browse files
committed
Optimize dockerfile
1 parent d995bd1 commit 3f2014b

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

Dockerfile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ RUN yarn install --network-timeout 1000000000
1111
COPY webapp .
1212
RUN yarn build-dev
1313

14+
### Download on a separate stage to run in parallel with buildkit
15+
FROM jupyter/base-notebook:hub-1.5.0 as downloads
16+
USER root
17+
RUN wget --no-check-certificate -O /nyhead.mat https://www.parralab.org/nyhead/sa_nyhead.mat
18+
1419
###
1520
FROM jupyter/base-notebook:hub-1.5.0
1621
ENV NB_UID=jovyan
@@ -31,22 +36,29 @@ COPY --chown=1000:1000 requirements.txt requirements.txt
3136
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
3237
pip install -r requirements.txt --prefer-binary
3338

34-
COPY . .
35-
COPY --from=jsbuild --chown=1000:1000 $FOLDER/webapp/build webapp/build
3639

3740
# ToDo: fixme, for now remove the jupyter hub config json file because it overrides the default
3841
# and thus removes the frame ancestor cors settings
3942
RUN rm -f ~/.jupyter/*.json
4043
RUN chown $NB_UID .
4144
RUN chown $NB_UID /opt
4245
RUN rm -Rf workspace
43-
44-
USER $NB_UID
45-
4646
# sym link workspace pvc to $FOLDER
4747
RUN mkdir -p /opt/workspace
4848
RUN mkdir -p /opt/user
4949

50+
COPY netpyne_ui netpyne_ui
51+
COPY utilities utilities
52+
COPY setup.py .
53+
COPY tests tests
54+
COPY NetPyNE-UI .
55+
COPY README.rst .
56+
COPY requirements-test.txt .
57+
58+
USER $NB_UID
59+
60+
61+
5062

5163
ENV NEURON_HOME=/opt/conda
5264

@@ -61,15 +73,17 @@ RUN jupyter serverextension enable --py --sys-prefix jupyter_geppetto
6173
ARG BUILD_ARGS=""
6274
ARG WORKSPACE_VERSION=master
6375
RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\
64-
python utilities/install.py ${BUILD_ARGS} --workspace $WORKSPACE_VERSION
76+
python utilities/install.py ${BUILD_ARGS} --workspace $WORKSPACE_VERSION --npm-skip
6577

6678

6779
RUN mv workspace /opt/workspace/tutorials
6880
RUN chown -R $NB_UID /opt/workspace/tutorials
6981
RUN ln -s /opt/workspace workspace
7082

7183
RUN jupyter labextension disable @jupyterlab/hub-extension
72-
RUN wget --no-check-certificate -O $NP_LFPYKIT_HEAD_FILE https://www.parralab.org/nyhead/sa_nyhead.mat
84+
85+
COPY --from=downloads --chown=1000:1000 /nyhead.mat $NP_LFPYKIT_HEAD_FILE
86+
COPY --from=jsbuild --chown=1000:1000 $FOLDER/webapp/build webapp/build
7387

7488
USER $NB_UID
7589

0 commit comments

Comments
 (0)