Extension installation recommendation

Hi, I have a docker image that has jupyter lab installed, what is the recommended way to install mixture of local(pkg1) and public labextensions(pkg2)
jupyter labextension install pkg1 --no-build && jupyter lab extension install pkg2 --no-build && jupyter build && npm cache clean --force
vs
jupyter labextension install pkg1 --dev-build=False && jupyter labextension install pkg2 --dev-build=False

Not sure where it has been mentioned, but doing a multi-stage build is the most predictable way to clean up everything: do you even want nodejs in the final build? This approach lets you not even bother with build cruft, you just grab everything from $PREFIX/share/jupyter/lab/ that isn’t staging.

At any rate, if you want to keep it “simple”, this is about everything I can think of, if you value final image size over deubggability:

RUN jupyter labextension install --no-build \
      pkg1 \
      pkg2 \
    && jupyter lab build --dev-build=False --minimize=True \
    && jlpm cache clean --all \
    && rm -rf \
      $PREFIX/share/jupyter/lab/staging \
      $PREFIX/share/jupyter/lab/static/*.map \
      /tmp/npm-*

For more, even if you aren’t using conda, check out this writeup.

3 Likes

Hi @bollwyvl Thanks for the reply. Can you elaborate on what debuggability I will lose if I use the second approach.

I guess you meant debugging from .map files used for production