Dockerfile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # Build image
  2. FROM mambaorg/micromamba:0.14.0 as build
  3. # Install basic tools
  4. RUN micromamba install -qy -c conda-forge python nodejs yarn=1.21 build
  5. # Install python dependencies - faster build thanks to caching
  6. COPY setup.cfg /tmp
  7. RUN list_package=$(python -c "from configparser import ConfigParser; c = ConfigParser(); c.read('/tmp/setup.cfg'); print(' '.join(c['options']['install_requires'].strip().splitlines()))") \
  8. && micromamba install -qy -c conda-forge $list_package
  9. # Build JupyterLab wheel
  10. COPY ./builder /tmp/jupyterlab-dev/builder
  11. COPY ./buildutils /tmp/jupyterlab-dev/buildutils
  12. COPY ./dev_mode /tmp/jupyterlab-dev/dev_mode
  13. COPY ./jupyterlab /tmp/jupyterlab-dev/jupyterlab
  14. COPY ./packages /tmp/jupyterlab-dev/packages
  15. COPY ./scripts /tmp/jupyterlab-dev/scripts
  16. COPY ./*.* ./LICENSE /tmp/jupyterlab-dev/
  17. RUN pushd /tmp/jupyterlab-dev \
  18. && pip install -e . \
  19. && jlpm install \
  20. && jlpm run build \
  21. && python -m build .
  22. # Runtime image
  23. FROM mambaorg/micromamba:0.14.0
  24. RUN micromamba install -qy -c conda-forge python \
  25. && useradd --shell /bin/bash jovyan \
  26. && chown jovyan $HOME
  27. # Install python dependencies - faster build thanks to caching
  28. COPY setup.cfg /tmp
  29. RUN list_package=$(python -c "from configparser import ConfigParser; c = ConfigParser(); c.read('/tmp/setup.cfg'); print(' '.join(c['options']['install_requires'].strip().splitlines()))") \
  30. && micromamba install -qy -c conda-forge $list_package \
  31. && micromamba clean --all --yes \
  32. && rm /tmp/setup.cfg
  33. USER jovyan
  34. WORKDIR ${HOME}
  35. # Install JupyterLab
  36. ENV PATH="/home/micromamba/.local/bin:$PATH"
  37. COPY --from=build /tmp/jupyterlab-dev/dist/jupyterlab*.whl /tmp
  38. RUN pip install /tmp/jupyterlab*.whl \
  39. # TODO remove when ipykernel 6 is released
  40. && pip install --pre --upgrade ipykernel \
  41. && mkdir -p /home/micromamba/jlab_root
  42. COPY ./docker/jupyter_server_config.json /etc/jupyter/
  43. EXPOSE 8888
  44. ENTRYPOINT ["jupyter", "lab"]