Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ target/

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version
Expand Down
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ RUN mamba env update -n base -f /tmp/environment.yml && \
pip uninstall -y torch torchvision && \
# Install PyTorch packages without cache - conditionally based on variant
if [ "$PYTORCH_VARIANT" = "cpu" ]; then \
echo "Installing CPU-only PyTorch" && \
pip install --no-cache-dir --force-reinstall torch torchvision --index-url https://download.pytorch.org/whl/cpu; \
echo "Installing CPU-only PyTorch" && \
pip install --no-cache-dir --force-reinstall torch torchvision --index-url https://download.pytorch.org/whl/cpu; \
else \
echo "Installing CUDA-enabled PyTorch" && \
pip install --no-cache-dir --force-reinstall torch torchvision; \
echo "Installing CUDA-enabled PyTorch" && \
pip install --no-cache-dir --force-reinstall torch torchvision; \
fi && \
# Clean up all package caches to reduce image size
mamba clean --all -f -y && \
Expand Down Expand Up @@ -63,6 +63,17 @@ RUN apt-get update && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# System-wide Jupyter Server config
COPY docker/jupyter_server_config.py /opt/conda/etc/jupyter/

# Jupyter Lab settings
RUN mkdir -p /opt/conda/share/jupyter/lab/settings
COPY docker/overrides.json /opt/conda/share/jupyter/lab/settings/

# System-wide IPython profile config
RUN mkdir -p /opt/conda/etc/ipython
COPY docker/ipython_config.py /opt/conda/etc/ipython/

# Switch back to the default notebook user
USER ${NB_UID}

Expand All @@ -72,9 +83,6 @@ COPY --from=builder ${CONDA_DIR} ${CONDA_DIR}
# Copy home directory with configurations
COPY --from=builder --chown=${NB_UID}:${NB_GID} /home/${NB_USER} /home/${NB_USER}

# Prepare IPython configuration
COPY --chown=${NB_UID}:${NB_GID} binder/ipython_config.py ${HOME}/.ipython/profile_default/

# Set the working directory to user's home (repository will be cloned here by Renku)
WORKDIR /home/${NB_USER}

Expand Down
4 changes: 3 additions & 1 deletion binder/ipython_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@

## lines of code to run at IPython startup.
# Default: []
# c.InteractiveShellApp.exec_lines = []
c.InteractiveShellApp.exec_lines = [
"from typing import Any, Callable, Dict, List, Optional, Tuple, Union"
]

## A list of dotted module names of IPython extensions to load.
# Default: []
Expand Down
10 changes: 10 additions & 0 deletions docker/ipython_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Configuration file for ipython.
c = get_config() # noqa # type: ignore

# Automatically load testsuite extension
c.InteractiveShellApp.extensions = ["tutorial.tests.testsuite"]

# Automatically import some modules
c.InteractiveShellApp.exec_lines = [
"from typing import Any, Callable, Dict, List, Optional, Tuple, Union"
]
6 changes: 6 additions & 0 deletions docker/jupyter_server_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Configuration file for jupyter server.

c = get_config() # noqa # type: ignore

# Allow serving files/folders beginning with a dot
c.ContentsManager.allow_hidden = True
5 changes: 5 additions & 0 deletions docker/overrides.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"@jupyterlab/filebrowser-extension:browser": {
"showHiddenFiles": true
}
}