Files
OBIJupyterHub/obijupyterhub/Dockerfile

79 lines
3.0 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 \
r-base \
libcurl4-openssl-dev libssl-dev libxml2-dev \
curl \
2025-11-05 17:29:12 +01:00
git \
2025-11-01 21:49:18 +01:00
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/*
2025-10-15 07:15:05 +02:00
2025-11-01 21:49:18 +01:00
# Installer R et packages
2025-11-05 17:29:12 +01:00
RUN R -e "install.packages(c('IRkernel','tidyverse','vegan','ade4','BiocManager','remotes','igraph'), \
dependencies=TRUE, \
repos='http://cran.rstudio.com/')" && \
2025-11-01 21:49:18 +01:00
R -e "BiocManager::install('biomformat')" && \
R -e "remotes::install_github('metabaRfactory/metabaR')" && \
2025-11-05 17:29:12 +01:00
R -e "remotes::install_git('https://forge.metabarcoding.org/obitools/ROBIUtils.git')" && \
R -e "remotes::install_git('https://forge.metabarcoding.org/obitools/ROBITaxonomy.git')" && \
R -e "remotes::install_git('https://forge.metabarcoding.org/obitools/ROBITools.git')" && \
R -e "remotes::install_git('https://forge.metabarcoding.org/obitools/ROBITaxonomy.git')" && \
R -e "remotes::install_git('https://forge.metabarcoding.org/MetabarcodingSchool/biodiversity-metrics.git')" && \
2025-11-01 21:49:18 +01:00
R -e "IRkernel::installspec(user = FALSE)" && \
rm -rf /tmp/Rtmp*
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
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 && \
2025-10-15 14:08:52 +02:00
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"