|
1 | | -FROM gcr.io/metacellllc/netpyne-ui:1.1.1 |
2 | 1 |
|
3 | | -COPY overrides/requirements.txt overrides/requirements.txt |
| 2 | + |
| 3 | +FROM node:18 as jsbuild |
| 4 | +ARG APP_DIR=dependencies/NetPyNE-UI |
| 5 | +ENV FOLDER=netpyne |
| 6 | + |
| 7 | +WORKDIR $FOLDER/webapp |
| 8 | +COPY $APP_DIR/webapp/package.json . |
| 9 | +COPY $APP_DIR/webapp/yarn.lock . |
| 10 | + |
| 11 | +RUN yarn install --network-timeout 1000000000 |
| 12 | + |
| 13 | +COPY $APP_DIR/webapp . |
| 14 | +RUN yarn build-dev |
| 15 | + |
| 16 | +### Download on a separate stage to run in parallel with buildkit |
| 17 | +FROM quay.io/jupyter/base-notebook:latest as downloads |
| 18 | +USER root |
| 19 | +RUN wget --no-check-certificate -O /nyhead.mat https://www.parralab.org/nyhead/sa_nyhead.mat |
| 20 | + |
| 21 | +### |
| 22 | +FROM quay.io/jupyter/base-notebook:latest |
| 23 | +ARG APP_DIR=dependencies/NetPyNE-UI |
| 24 | +ENV NB_UID=jovyan |
| 25 | +ENV FOLDER=netpyne |
| 26 | +ENV NP_LFPYKIT_HEAD_FILE=/home/jovyan/nyhead.mat |
| 27 | + |
| 28 | +USER root |
| 29 | + |
| 30 | +RUN rm -rf /var/lib/apt/lists |
| 31 | +RUN apt-get update -qq &&\ |
| 32 | + apt-get install python3-tk vim nano unzip git make libtool g++ -qq pkg-config libfreetype6-dev libpng-dev libopenmpi-dev -y |
| 33 | +RUN apt-get install openjdk-11-jre-headless -y |
| 34 | +# RUN conda install python=3.7 -y |
| 35 | + |
| 36 | + |
| 37 | +WORKDIR $FOLDER |
| 38 | +COPY overrides/requirements.txt ./requirements.txt |
4 | 39 | RUN --mount=type=cache,target=/root/.cache python -m pip install --upgrade pip &&\ |
5 | | - pip install -r overrides/requirements.txt |
| 40 | + pip install -r requirements.txt |
| 41 | + |
| 42 | +# ToDo: fixme, for now remove the jupyter hub config json file because it overrides the default |
| 43 | +# and thus removes the frame ancestor cors settings |
| 44 | +RUN rm -f ~/.jupyter/*.json |
| 45 | +RUN chown $NB_UID . |
| 46 | +RUN chown $NB_UID /opt |
| 47 | +RUN rm -Rf workspace |
| 48 | +# sym link workspace pvc to $FOLDER |
| 49 | +RUN mkdir -p /opt/workspace |
| 50 | +RUN mkdir -p /opt/user |
| 51 | + |
| 52 | + |
| 53 | +COPY $APP_DIR/netpyne_ui netpyne_ui |
| 54 | +COPY $APP_DIR/utilities utilities |
| 55 | +COPY $APP_DIR/setup.py . |
| 56 | +COPY $APP_DIR/tests tests |
| 57 | +COPY $APP_DIR/NetPyNE-UI . |
| 58 | +COPY $APP_DIR/README.rst . |
| 59 | +COPY $APP_DIR/requirements-test.txt . |
| 60 | + |
| 61 | + |
| 62 | +USER $NB_UID |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +ENV NEURON_HOME=/opt/conda |
| 68 | + |
| 69 | + |
| 70 | +USER root |
| 71 | + |
| 72 | +RUN jupyter nbextension install --py --symlink --sys-prefix jupyter_geppetto |
| 73 | +RUN jupyter nbextension enable --py --sys-prefix jupyter_geppetto |
| 74 | +RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension |
| 75 | +RUN jupyter serverextension enable --py --sys-prefix jupyter_geppetto |
| 76 | + |
| 77 | +ARG BUILD_ARGS="" |
| 78 | +ARG WORKSPACE_VERSION=master |
| 79 | + |
| 80 | +RUN --mount=type=cache,target=/home/jovyan/.cache python -m pip install --upgrade pip &&\ |
| 81 | + python utilities/install.py ${BUILD_ARGS} --workspace $WORKSPACE_VERSION --npm-skip --no-test |
| 82 | + |
| 83 | + |
| 84 | +RUN mv workspace /opt/workspace/tutorials |
| 85 | +RUN chown -R $NB_UID /opt/workspace |
| 86 | +RUN ln -s /opt/workspace workspace |
| 87 | + |
| 88 | +# RUN jupyter labextension disable @jupyterlab/hub-extension |
| 89 | + |
| 90 | +COPY --from=downloads --chown=1000:1000 /nyhead.mat $NP_LFPYKIT_HEAD_FILE |
| 91 | +COPY --from=jsbuild --chown=1000:1000 $FOLDER/webapp/build webapp/build |
| 92 | + |
| 93 | +RUN chown -R $NB_UID /home/jovyan/.jupyter |
| 94 | +RUN touch app.log && chown $NB_UID app.log |
| 95 | +USER $NB_UID |
| 96 | + |
| 97 | + |
| 98 | +EXPOSE 8888 |
| 99 | + |
| 100 | + |
| 101 | +EXPOSE 8888 |
| 102 | + |
| 103 | + |
| 104 | +CMD jupyter notebook --NotebookApp.default_url=/geppetto --ServerApp.token='' --ServerApp.notebook_dir=workspace --library=netpyne_ui --ServerApp.disable_check_xsrf=True |
0 commit comments