FROM debian:stable AS build RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt update &&\ apt install -y python3 python3-dev pipx gcc g++ libffi-dev cargo cmake autoconf swig ninja-build patchelf meson python3-faiss adduser RUN adduser -u 1000 --system --shell /bin/sh --home /home/jovyan jovyan USER jovyan WORKDIR /home/jovyan RUN python3 -m venv venv RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install solders RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install solana RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install numpy RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install matplotlib RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyter-core RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyterhub RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyterlab RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install notebook RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install ipywidgets RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyterlab-lsp RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install python-lsp-server[yapf,rope,pyflakes] # RUN venv/bin/pip install --no-binary :all: faiss-cpu RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install jupyter-ai RUN --mount=type=cache,target=/home/jovyan/.cache/pip,uid=1000,gid=1000 venv/bin/pip install langchain-openai langchain_ollama #RUN venv/bin/pip install pylsp-mypy ENV PATH="/home/jovyan/venv/bin/:$PATH" FROM debian:stable RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ --mount=type=cache,target=/var/lib/apt,sharing=locked \ apt update &&\ apt install -y python3 adduser RUN adduser -u 1000 --system --shell /bin/sh --home /home/jovyan jovyan USER jovyan COPY --from=build /home/jovyan /home/jovyan COPY jupyter_server_config.py docker_healthcheck.py /etc/jupyter/ COPY start-notebook.py start-singleuser.py /usr/local/bin/ RUN mkdir /home/jovyan/work WORKDIR /home/jovyan/work ENV JUPYTER_PORT=8888 EXPOSE $JUPYTER_PORT ENV PATH="/home/jovyan/venv/bin/:$PATH" CMD ["start-notebook.py"] # HEALTHCHECK documentation: https://docs.docker.com/engine/reference/builder/#healthcheck # This healtcheck works well for `lab`, `notebook`, `nbclassic`, `server`, and `retro` jupyter commands # https://github.com/jupyter/docker-stacks/issues/915#issuecomment-1068528799 HEALTHCHECK --interval=3s --timeout=1s --start-period=3s --retries=3 \ CMD /etc/jupyter/docker_healthcheck.py || exit 1