Downsize the student image
This commit is contained in:
@@ -1,40 +1,53 @@
|
||||
# ---------- Stage 1 : builder ----------
|
||||
FROM jupyter/base-notebook:latest AS builder
|
||||
# ---------- Stage 1 : builder pour csvlens ----------
|
||||
FROM jupyter/base-notebook:latest AS rust-builder
|
||||
|
||||
USER root
|
||||
|
||||
# Install system dependencies for R, build tools and Go/Rust
|
||||
# Installer seulement les dépendances pour compiler csvlens
|
||||
RUN apt-get update && apt-get install -y \
|
||||
r-base r-base-dev \
|
||||
libcurl4-openssl-dev libssl-dev libxml2-dev \
|
||||
build-essential git curl \
|
||||
texlive-xetex texlive-fonts-recommended texlive-plain-generic \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
curl build-essential zlib1g-dev unzip \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install R kernel + useful packages
|
||||
RUN R -e "install.packages('IRkernel', repos='http://cran.rstudio.com/')" && \
|
||||
R -e "IRkernel::installspec(user = FALSE)" && \
|
||||
R -e "install.packages(c('tidyverse','vegan','ade4'), repos='http://cran.rstudio.com/')"
|
||||
|
||||
# Install bash kernel
|
||||
RUN pip install bash_kernel && python -m bash_kernel.install --sys-prefix
|
||||
# Installer Rust et compiler csvlens
|
||||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
|
||||
RUN . $HOME/.cargo/env && cargo install csvlens
|
||||
|
||||
# Install obitools4
|
||||
RUN curl -L https://raw.githubusercontent.com/metabarcoding/obitools4/master/install_obitools.sh | bash
|
||||
RUN TEMP=. curl -L https://raw.githubusercontent.com/metabarcoding/obitools4/master/install_obitools.sh \
|
||||
| bash -s -- --install-dir $HOME/obitools-build \
|
||||
&& cp $HOME/obitools-build/bin/* /usr/local/bin
|
||||
RUN ls -l /usr/local/bin
|
||||
|
||||
# Install csvkit
|
||||
RUN pip install csvkit
|
||||
|
||||
# Install csvlens via Rust
|
||||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y && \
|
||||
. $HOME/.cargo/env && \
|
||||
cargo install csvlens
|
||||
# ---------- Stage 2 : image finale ----------
|
||||
FROM jupyter/base-notebook:latest
|
||||
|
||||
RUN apt-get update && apt-get install -y ruby ruby-dev build-essential \
|
||||
&& gem install youplot
|
||||
USER root
|
||||
|
||||
# Copy csvlens to /usr/local/bin for final use
|
||||
RUN cp $HOME/.cargo/bin/csvlens /usr/local/bin/
|
||||
# Installer seulement les dépendances d'exécution (sans build-essential)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
r-base \
|
||||
libcurl4-openssl-dev libssl-dev libxml2-dev \
|
||||
curl \
|
||||
texlive-xetex texlive-fonts-recommended texlive-plain-generic \
|
||||
ruby ruby-dev \
|
||||
vim nano \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Installer R et packages
|
||||
RUN R -e "install.packages(c('IRkernel','tidyverse','vegan','ade4','BiocManager','remotes'), repos='http://cran.rstudio.com/')" && \
|
||||
R -e "BiocManager::install('biomformat')" && \
|
||||
R -e "remotes::install_github('metabaRfactory/metabaR')" && \
|
||||
R -e "IRkernel::installspec(user = FALSE)" && \
|
||||
rm -rf /tmp/Rtmp*
|
||||
|
||||
# Installer les autres outils
|
||||
RUN pip install --no-cache-dir bash_kernel csvkit && \
|
||||
python -m bash_kernel.install --sys-prefix
|
||||
|
||||
RUN gem install youplot
|
||||
|
||||
# Set permissions for Jupyter user
|
||||
RUN mkdir -p /home/${NB_USER}/.local/share/jupyter && \
|
||||
@@ -43,12 +56,14 @@ RUN mkdir -p /home/${NB_USER}/.local/share/jupyter && \
|
||||
COPY start-notebook.sh /usr/local/bin/start-notebook.sh
|
||||
RUN chmod +x /usr/local/bin/start-notebook.sh
|
||||
|
||||
# Copier uniquement le binaire csvlens du builder
|
||||
COPY --from=rust-builder /home/jovyan/.cargo/bin/csvlens /usr/local/bin/
|
||||
COPY --from=rust-builder /usr/local/bin/* /usr/local/bin/
|
||||
|
||||
# Switch back to Jupyter user
|
||||
USER ${NB_UID}:${NB_GID}
|
||||
WORKDIR /home/${NB_USER}/work
|
||||
|
||||
# Environment variables
|
||||
ENV PATH="/home/${NB_USER}/work/course/bin:${PATH}"
|
||||
ENV R_LIBS_USER="/home/${NB_USER}/work/R_packages"
|
||||
ENV R_LIBS_SITE="/home/${NB_USER}/work/course/R_packages:/usr/local/lib/R/site-library:/usr/lib/R/site-library"
|
||||
|
||||
|
||||
1993
obijupyterhub/build_student.log
Normal file
1993
obijupyterhub/build_student.log
Normal file
File diff suppressed because one or more lines are too long
@@ -76,6 +76,7 @@ c.DockerSpawner.volume_driver_opts = {
|
||||
'device': '/volumes',
|
||||
'o': 'bind'
|
||||
}
|
||||
|
||||
# Memory and CPU configuration (adjust according to your needs)
|
||||
c.DockerSpawner.mem_limit = '2G'
|
||||
c.DockerSpawner.cpu_limit = 1.0
|
||||
|
||||
Reference in New Issue
Block a user