|
| 1 | +FROM jupyter/minimal-notebook:latest |
| 2 | +LABEL org.opencontainers.image.source=https://github.com/scilifelabdatacentre/serve-images |
| 3 | + |
| 4 | +ARG SERVE_BRANCH=develop |
| 5 | +WORKDIR /home/jovyan |
| 6 | + |
| 7 | +COPY requirements.txt /tmp |
| 8 | +COPY imaging_based_data_analysis_env.yml /tmp |
| 9 | +COPY lab /home/jovyan/lab |
| 10 | +COPY start-script.sh /usr/local/bin/start-script.sh |
| 11 | + |
| 12 | +USER root |
| 13 | +RUN apt-get update && apt-get install curl -y --no-install-recommends && \ |
| 14 | + apt-get clean && rm -rf /var/lib/apt/lists/* |
| 15 | + |
| 16 | +RUN pip install --no-cache-dir -r /tmp/requirements.txt |
| 17 | + |
| 18 | +RUN conda install -n base -c conda-forge mamba |
| 19 | + |
| 20 | +RUN mamba env create -f /tmp/imaging_based_data_analysis_env.yml && conda clean --all --yes |
| 21 | + |
| 22 | +RUN echo "conda activate imaging_based_data_analysis_env" >> /etc/profile.d/conda.sh |
| 23 | + |
| 24 | +RUN /opt/conda/envs/imaging_based_data_analysis_env/bin/pip install ipykernel && \ |
| 25 | + /opt/conda/envs/imaging_based_data_analysis_env/bin/python -m ipykernel install --name imaging_based_data_analysis_env --display-name "Python (imaging_based_data_analysis_env)" |
| 26 | + |
| 27 | +RUN chown -R jovyan:users /opt/conda /home/jovyan/.cache /home/jovyan/lab && \ |
| 28 | + chmod -R a+rwx /home/jovyan/lab && \ |
| 29 | + chmod +x /usr/local/bin/start-script.sh |
| 30 | + |
| 31 | +USER jovyan |
| 32 | + |
| 33 | +# Set default conda environment |
| 34 | +ENV PATH=/opt/conda/envs/imaging_based_data_analysis_env/bin:$PATH |
| 35 | + |
| 36 | +# Disable Jupyter token authentication |
| 37 | +RUN jupyter notebook --generate-config && \ |
| 38 | + echo "c.NotebookApp.token = ''" >> /home/jovyan/.jupyter/jupyter_notebook_config.py && \ |
| 39 | + echo "c.NotebookApp.password = ''" >> /home/jovyan/.jupyter/jupyter_notebook_config.py && \ |
| 40 | + echo "c.NotebookApp.ip = '0.0.0.0'" >> /home/jovyan/.jupyter/jupyter_notebook_config.py && \ |
| 41 | + echo "c.NotebookApp.open_browser = False" >> /home/jovyan/.jupyter/jupyter_notebook_config.py |
| 42 | + |
| 43 | +# Set the startup script as the entrypoint |
| 44 | +ENTRYPOINT ["/usr/local/bin/start-script.sh"] |
0 commit comments