11ARG BASE=nvcr.io/nvidia/rapidsai/notebooks:25.10-cuda13-py3.13
2- FROM $BASE
2+
3+ ###############################################################################
4+ # Builder stage: Install conda packages and fix ownership
5+ ###############################################################################
6+ FROM $BASE as builder
7+
8+ USER root
9+
10+ # Install additional conda packages into base environment
11+ RUN . /opt/conda/etc/profile.d/conda.sh; conda activate base && \
12+ mamba install -y jupyterhub-singleuser jupyter-vscode-proxy jupyter-resource-usage jupyter-rsession-proxy plotnine ibis-duckdb duckdb-engine minio git-filter-repo glances
13+
14+ # Change ownership of conda to UID 1000 (this won't bloat final image)
15+ RUN chown -R 1000:1000 /opt/conda
16+
17+ ###############################################################################
18+ # Final stage
19+ ###############################################################################
20+ FROM rapidsai/miniforge-cuda:25.12-cuda13.0.1-base-ubuntu24.04-py3.13
21+
322
423# Use bash as default shell instead of sh
524ENV SHELL=/bin/bash
@@ -20,29 +39,11 @@ ENV HOME="/home/${NB_USER}"
2039USER root
2140# Remove the useless 'ubuntu' user that currently has UID 1000
2241RUN userdel -r ubuntu
42+ RUN useradd -rm -d /home/jovyan -s /bin/bash -g conda -u 1000 jovyan
2343
24- # Change rapids' UID from 1001 to 1000
25- # This ONLY modifies /etc/passwd, NOT the filesystem
26- RUN usermod -u 1000 rapids
27-
28- # Rename rapids to jovyan
29- RUN usermod -l jovyan rapids
30-
31- # Move and fix the home directory
32- RUN usermod -d /home/jovyan -m jovyan
33-
34-
35-
36- # Copy entrypoint to a safe location before home gets mounted over
37- RUN cp /home/jovyan/entrypoint.sh /usr/local/bin/entrypoint.sh && \
38- chmod +x /usr/local/bin/entrypoint.sh && \
39- chown 1000:1000 /usr/local/bin/entrypoint.sh && \
40- sed -i '4i . /opt/conda/etc/profile.d/conda.sh; conda activate notebook' /usr/local/bin/entrypoint.sh
41-
42- # Set the new entrypoint location
43- ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
44-
45- RUN groupadd --gid ${NB_UID} ${NB_USER}
44+ RUN apt-get update && apt-get -y install curl && rm -rf /var/lib/apt/lists/*
45+ # Copy the modified conda from builder (with packages installed and correct ownership)
46+ COPY --from=builder --chown=1000:1000 /opt/conda /opt/conda
4647
4748# install vscode
4849RUN curl -fsSL https://code-server.dev/install.sh | sh && rm -rf .cache
@@ -58,16 +59,18 @@ RUN adduser "$NB_USER" sudo && echo '%sudo ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoer
5859COPY install_r.sh install_r.sh
5960RUN bash install_r.sh
6061
61- # RStudio not available for arm
62+ # RStudio
63+ COPY install_rstudio.sh install_rstudio.sh
64+ RUN bash install_rstudio.sh
6265# RUN curl -s https://raw.githubusercontent.com/rocker-org/ml/refs/heads/master/install_rstudio.sh | bash
6366
6467COPY Rprofile /usr/lib/R/etc/Rprofile.site
6568
6669## Add rstudio's binaries to path for quarto
6770ENV PATH=$PATH:/usr/lib/rstudio-server/bin/quarto/bin
6871
69- # activate notebook by default (created later)
70- RUN sed 's/conda activate base/conda activate notebook /' /home/$NB_USER/.bashrc > /etc/profile.d/bashrc
72+ # activate base by default in bashrc
73+ # RUN sed 's/conda activate base/conda activate base /' /home/$NB_USER/.bashrc > /etc/profile.d/bashrc
7174
7275WORKDIR /home/$NB_USER
7376USER $NB_USER
@@ -83,10 +86,7 @@ RUN Rscript /tmp/install.r
8386COPY install_spatial.r /tmp/install.r
8487RUN Rscript /tmp/install.r
8588
86- RUN conda create -p /opt/conda/envs/notebook jupyterhub-singleuser jupyter-vscode-proxy jupyter-resource-usage
87- RUN . /opt/conda/etc/profile.d/conda.sh; conda activate notebook && mamba install plotnine ibis-duckdb duckdb-engine minio git-filter-repo glances
88-
89-
89+ USER $NB_USER
9090
9191CMD ["jupyter", "lab", "--no-browser", "--ip=0.0.0.0"]
9292
0 commit comments