Last active
January 7, 2025 09:23
-
-
Save informationsea/ee5127613813398bdad89f3968a1c0d7 to your computer and use it in GitHub Desktop.
Jupyter Notebook Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -xeu -o pipefail | |
PYTHON_VERSION=3.13.1 | |
PYTHON_VERSION_BASE=${PYTHON_VERSION%.*} | |
docker build -t notebook --build-arg PYTHON_VERSION=${PYTHON_VERSION} --build-arg PYTHON_VERSION_BASE=${PYTHON_VERSION_BASE} . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM almalinux:9 AS download | |
RUN dnf update -y && dnf install --allowerasing -y wget curl | |
ARG PYTHON_VERSION=3.11.9 | |
RUN wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz | |
RUN tar xzf Python-${PYTHON_VERSION}.tgz | |
FROM almalinux:9 AS build | |
RUN dnf update -y && dnf install -y epel-release && crb enable && dnf update -y | |
RUN dnf install --allowerasing -y gcc gcc-c++ make autoconf automake bzip2-devel zlib-devel xz-devel ncurses-devel libcurl-devel openssl-devel tcl-devel tk-devel sqlite-devel readline-devel libffi-devel gdbm-devel | |
WORKDIR /build | |
ARG PYTHON_VERSION=3.11.9 | |
ARG PYTHON_VERSION_BASE=3.11 | |
COPY --from=download /Python-${PYTHON_VERSION} /build/Python-${PYTHON_VERSION} | |
WORKDIR /build/Python-${PYTHON_VERSION} | |
ENV PATH="/opt/python3/${PYTHON_VERSION_BASE}/bin:${PATH}" | |
RUN ./configure --enable-optimizations --enable-shared --prefix=/opt/python3/${PYTHON_VERSION_BASE} && make -j4 && make install | |
FROM almalinux:9 AS r-install | |
RUN dnf update -y && dnf install -y epel-release && crb enable && dnf update -y | |
RUN dnf install --allowerasing -y gcc gcc-c++ make autoconf automake bzip2-devel zlib-devel xz-devel ncurses-devel libcurl-devel openssl-devel tcl-devel tk-devel sqlite-devel readline-devel libffi-devel gdbm-devel | |
RUN dnf install --allowerasing -y gcc gcc-c++ make autoconf automake bzip2-devel \ | |
zlib-devel xz-devel ncurses-devel libcurl-devel openssl-devel tcl-devel \ | |
tk-devel sqlite-devel readline-devel libffi-devel gdbm-devel zlib bzip2 \ | |
bzip2-libs xz ncurses openssl tcl tk sqlite readline libffi atlas-devel \ | |
openblas blas lapack gcc-gfortran ruby R \ | |
bzip2-devel xz-devel zlib-devel libcurl-devel \ | |
openssl-devel tcl-devel tk-devel sqlite-devel readline-devel libffi-devel \ | |
texinfo file diffutils libX11-devel libXt-devel libpng-devel cairo-devel \ | |
libtiff-devel libicu-devel pcre2-devel java-21-openjdk-devel libxml2-devel \ | |
hdf5-devel harfbuzz-devel fribidi-devel udunits2-devel proj-devel libjpeg-turbo-devel | |
COPY install.R /tmp/install.R | |
RUN Rscript /tmp/install.R | |
FROM almalinux:9 | |
RUN dnf update -y && dnf install -y epel-release && crb enable && dnf update -y | |
RUN dnf install --allowerasing -y gcc gcc-c++ make autoconf automake bzip2-devel \ | |
zlib-devel xz-devel ncurses-devel libcurl-devel openssl-devel tcl-devel \ | |
tk-devel sqlite-devel readline-devel libffi-devel gdbm-devel zlib bzip2 \ | |
bzip2-libs xz ncurses openssl tcl tk sqlite readline libffi atlas-devel \ | |
openblas blas lapack gcc-gfortran ruby R \ | |
bzip2-devel xz-devel zlib-devel libcurl-devel \ | |
openssl-devel tcl-devel tk-devel sqlite-devel readline-devel libffi-devel \ | |
texinfo file diffutils libX11-devel libXt-devel libpng-devel cairo-devel \ | |
libtiff-devel libicu-devel pcre2-devel java-21-openjdk-devel libxml2-devel \ | |
hdf5-devel harfbuzz-devel fribidi-devel udunits2-devel proj-devel libjpeg-turbo-devel | |
RUN curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash - && yum install -y nodejs | |
ARG PYTHON_VERSION_BASE=3.11 | |
COPY --from=build /opt/python3/${PYTHON_VERSION_BASE} /opt/python3/${PYTHON_VERSION_BASE} | |
ENV PATH="/opt/python3/${PYTHON_VERSION_BASE}/bin:${PATH}" | |
ENV LD_LIBRARY_PATH="/opt/python3/${PYTHON_VERSION_BASE}/lib:/opt/python3/${PYTHON_VERSION_BASE}/lib64" | |
RUN pip3 install --upgrade pip wheel | |
RUN pip3 install jupyterlab voila mypy "python-lsp-server[all]" "polars[all]" numpy scipy pandas | |
RUN pip3 install jupyter-book notebook jupyterhub bash_kernel | |
RUN python3 -m bash_kernel.install | |
COPY --from=r-install /usr/lib64/R/library /usr/lib64/R/library | |
RUN ln -s /etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt | |
COPY install2.R /tmp/install2.R | |
RUN Rscript /tmp/install2.R | |
# RUN npm install -g ijavascript && ijsinstall | |
RUN dnf install -y ruby ruby-devel make zeromq-devel rubygem-rake | |
# ARG RSTUDIO_VERSION=2023.12.1-402 | |
# WORKDIR /tmp | |
# RUN curl -OL https://download2.rstudio.org/server/rhel9/x86_64/rstudio-server-rhel-${RSTUDIO_VERSION}-x86_64.rpm | |
# RUN dnf install -y rstudio-server-rhel-${RSTUDIO_VERSION}-x86_64.rpm | |
RUN useradd -m -s /bin/bash jupyter | |
USER jupyter | |
WORKDIR /home/jupyter | |
RUN curl -fsSL https://install.julialang.org > /tmp/julia-install.sh && bash /tmp/julia-install.sh -y | |
RUN source ~/.bashrc && julia -e 'using Pkg; Pkg.add("IJulia")' | |
# RUN ijsinstall && python3 -m bash_kernel.install | |
ENV PATH="/home/jupyter/bin:${PATH}" | |
RUN gem install --user-install iruby && iruby register --force | |
RUN curl -fsSL https://deno.land/install.sh | sh | |
ENV DENO_INSTALL="/home/jupyter/.deno" | |
ENV PATH="$DENO_INSTALL/bin:$PATH" | |
RUN deno jupyter --install | |
CMD ["jupyter", "lab", "--ip=0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
options(repos="http://cran.rstudio.com/") | |
install.packages(c("devtools", "tidyverse")) | |
library(devtools) | |
devtools::install_github("melff/RKernel/pkg") | |
RKernel::installspec() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RKernel::installspec() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment