Spaces:
Running
Running
################## | |
# Building Stage # | |
################## | |
FROM jupyter/base-notebook:python-3.10.11 AS builder | |
COPY requirements.txt . | |
RUN python3 -m pip install --user --no-cache-dir --upgrade pip && \ | |
conda install -c conda-forge sentencepiece==0.1.95 && \ | |
python3 -m pip install --user --no-cache-dir -r requirements.txt && \ | |
python3 -m pip install --user --no-cache-dir --force-reinstall spacy==3.5.0 | |
################# | |
# Running Stage # | |
################# | |
FROM jupyter/base-notebook:python-3.10.11 AS run | |
# Copy installed python packages (they are installed in that directory) | |
COPY --from=builder /home/jovyan/.local/ /home/jovyan/.local | |
USER root | |
ENV PYTHONPATH "/home/jovyan/work/" | |
USER $NB_USER | |
# Install necessary jupyter packages for writing here. e.g. | |
RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension | |
#################### | |
# Deployment Stage # | |
#################### | |
FROM jupyter/base-notebook:python-3.10.11 AS deploy | |
# Copy installed python packages (they are installed in that directory) | |
COPY --from=builder /home/jovyan/.local/ /home/jovyan/.local | |
COPY notebooks . | |
COPY docker/run_voila . | |
USER root | |
EXPOSE 7860 | |
ENV PYTHONPATH "/home/jovyan/work/" | |
USER $NB_USER | |
# Install necessary jupyter packages for deployment here. e.g. | |
RUN jupyter nbextension enable --py --sys-prefix widgetsnbextension \ | |
&& jupyter nbextension install --py --symlink --sys-prefix ipympl \ | |
&& jupyter nbextension enable --py --sys-prefix ipympl \ | |
&& jupyter nbextension install --py --symlink --sys-prefix ipysheet \ | |
&& jupyter nbextension enable --py --sys-prefix ipysheet \ | |
&& jupyter nbextension enable --py --sys-prefix voila | |
CMD ["bash", "-c", "nohup ./run_voila & jupyter notebook --ip=0.0.0.0 --port=7860 --no-browser --allow-root --NotebookApp.token='huggingface' --NotebookApp.max_buffer_size=5368709120 --NotebookApp.tornado_settings=\"{'headers': {'Content-Security-Policy': 'frame-ancestors *'}}\" --NotebookApp.cookie_options=\"{'SameSite': 'None', 'Secure': True}\" --NotebookApp.disable_check_xsrf=True"] |