Files
OBIJupyterHub/obijupyterhub/Dockerfile

113 lines
3.4 KiB
Docker
Raw Normal View History

2025-11-01 21:49:18 +01:00
# ---------- Stage 1 : builder pour csvlens ----------
FROM jupyter/base-notebook:latest AS rust-builder
2025-10-14 17:40:41 +02:00
USER root
2025-11-01 21:49:18 +01:00
# Installer seulement les dépendances pour compiler csvlens
2025-10-14 17:40:41 +02:00
RUN apt-get update && apt-get install -y \
2025-11-01 21:49:18 +01:00
curl build-essential zlib1g-dev unzip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
2025-10-14 17:40:41 +02:00
2025-11-01 21:49:18 +01:00
# Installer Rust et compiler csvlens
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
RUN . $HOME/.cargo/env && cargo install csvlens
2025-10-14 17:40:41 +02:00
2025-10-15 14:08:52 +02:00
# Install obitools4
2025-11-01 21:49:18 +01:00
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
# ---------- Stage 2 : image finale ----------
FROM jupyter/base-notebook:latest
USER root
2025-10-15 07:15:05 +02:00
2025-11-01 21:49:18 +01:00
# Installer seulement les dépendances d'exécution (sans build-essential)
RUN apt-get update && apt-get install -y --no-install-recommends \
# R et dépendances de base
2025-11-01 21:49:18 +01:00
r-base \
r-base-dev \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libicu-dev \
zlib1g-dev \
# Polices et rendu graphique (indispensable pour ggplot2, ragg, etc.)
libharfbuzz-dev \
libfribidi-dev \
libfontconfig1-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
pandoc \
# Outils de compilation et gestion de versions
libgit2-dev \
cmake \
# Utilitaires systèmes déjà présents dans votre Dockerfile
2025-11-01 21:49:18 +01:00
curl \
wget \
2025-11-05 17:29:12 +01:00
git \
vim \
nano \
less \
gdebi-core \
ripgrep \
# Pour générer des PDF/rapports depuis R Markdown / Jupyter
texlive-xetex \
texlive-luatex \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-latex-extra \
texlive-plain-generic \
lmodern \
fonts-lmodern \
librsvg2-bin \
cm-super \
# Ruby (si vous en avez besoin pour autre chose)
ruby \
ruby-dev \
2025-11-01 21:49:18 +01:00
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2025-10-15 07:15:05 +02:00
2025-11-01 21:49:18 +01:00
# Installer R et packages
COPY install_R_packages.R /tmp/install_R_packages.R
RUN Rscript /tmp/install_R_packages.R --no-save --no-restore && \
rm -rf /tmp/Rtmp* /tmp/install_R_packages.R
2025-10-15 14:08:52 +02:00
2025-11-01 21:49:18 +01:00
# Installer les autres outils
RUN pip install --no-cache-dir bash_kernel csvkit && \
python -m bash_kernel.install --sys-prefix
2025-10-15 14:08:52 +02:00
2025-11-01 21:49:18 +01:00
RUN gem install youplot
2025-10-15 07:15:05 +02:00
# Installation de Quarto (multi-arch)
RUN ARCH=$(dpkg --print-architecture) && \
QUARTO_VERSION="1.8.27" && \
wget https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-${ARCH}.deb && \
gdebi --non-interactive quarto-${QUARTO_VERSION}-linux-${ARCH}.deb && \
rm quarto-${QUARTO_VERSION}-linux-${ARCH}.deb
2025-10-15 14:08:52 +02:00
# Set permissions for Jupyter user
2025-10-14 17:40:41 +02:00
RUN mkdir -p /home/${NB_USER}/.local/share/jupyter && \
chown -R ${NB_UID}:${NB_GID} /home/${NB_USER}
2025-10-14 17:40:41 +02:00
2025-10-16 01:07:07 +02:00
2025-11-01 21:49:18 +01:00
# 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/
2025-11-16 14:56:03 +01:00
COPY start-notebook.sh /usr/local/bin/start-notebook.sh
RUN chmod +x /usr/local/bin/start-notebook.sh
2025-10-15 14:08:52 +02:00
# Switch back to Jupyter user
USER ${NB_UID}:${NB_GID}
WORKDIR /home/${NB_USER}/work
2025-10-14 17:40:41 +02:00
2025-10-15 14:08:52 +02:00
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"