New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create dev environment with docker #15111
Conversation
Thanks for making a pull request to jupyterlab! |
1ed99e9
to
671a300
Compare
cc @jtpio for awareness |
Thanks @trungleduc. Maybe this will also be useful to enable better support for dev containers and GitHub Codespaces. And also streamline the setup between Gitpod and Codespaces: #13049 |
Also should there be a new section in the contributing guide to mention how to use this setup? https://jupyterlab.readthedocs.io/en/latest/developer/contributing.html |
185db81
to
5368cad
Compare
Done |
756ad8a
to
ac9e1d2
Compare
Similar to the discussion about Vagrant (#12806 and jupyterlab/frontends-team-compass#152 (comment)), one of the main challenges with this setup will be for maintainers to be able to maintain this Docker configuration, since Docker is yet another tool and not everyone might be familiar with it. But since Docker is available on GitHub Actions by default maybe there could be a way to put it under tests? To make sure the config does not lag behind or become out of date. |
ef36310
to
4e6a7cf
Compare
4e6a7cf
to
e20df15
Compare
@jtpio I added a workflow for building and starting the dev container (https://github.com/jupyterlab/jupyterlab/actions/runs/6312097376/job/17137422797?pr=15111). But I am not sure about the activation rate, running this test on every commit wastes a lot of resources. |
We could run it on PR approval only, as we do with benchmarks. |
Otherwise as a cron job? But I guess we would first need to know if someone from the JupyterLab maintainers will be willing to maintain this new dev setup. |
I can maintain this script but I am also open to move it outside of the JupyterLab repo |
I am ok with having this in if it helps at least one contributor - if it falls unmaintained, removing it will be easy (4 files to delete plus documentation fragment to cut). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @trungleduc
a cron job sounds good! I'll update the action script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
References
Similar to the
gitpod
setup, but for people who prefer to work offline.To start a JupyterLab dev container on a UNIX system with docker installed:
This command will build the docker image if it does not exist, then start the container with JupyterLab running in watch mode. The port
8888
is exposed and the current JupyterLab repo is mounted into the container.Other available commands:
bash docker/start.sh dev
: same as callingbash docker/start.sh
bash docker/start.sh stop
: stop the running containerbash docker/start.sh clean
: remove the docker imagebash docker/start.sh build
: rebuild the docker imagebash docker/start.sh shell
: log into the container's shell with the JupyterLab environment activated. It's useful to run the tests or install dependencies.How it works
To avoid polluting the
node_module
directory with packages coming from the host machine while still preserving the hot-reload capability, the js dependencies in the container are actually stored in the/home/$DEV_USER/jupyterlab_cache/node_modules/
while the working directory is mounted to/home/$DEV_USER/jupyterlab
. On container startup, thenode_modules
atjupyterlab_cache
isrsync-ed
back to the host.Since the image and container name contain the hash of the current JupyterLab directory, two clones of JupyterLab will generate different images.
How to add dependencies
Due to the above setup, the easiest way to add new dependencies is to log into the container's shell, install the dependencies to update the
package.json
andyarn.lock
files, and then rebuild the docker image.