In order to install an extension for Jupyter or JupyterLab Notebooks and ensure it persists across all your workspace sessions you will need to install it in your compute environment first. Some common extensions used are part of the nbextension package. Below you will find the commands needed to install the nbextension package (and all the extensions it includes) and enable the codefolding extension. You can use this code as a base to install/enable any other nbextension by simply editing the last line of code with the appropriate extension you want to enable.
Add the following to the dockerfile of your compute environment:
RUN pip install jupyter_contrib_nbextensions RUN jupyter contrib nbextension install --system RUN jupyter nbextension enable codefolding/main