Hello community,
I need to setup a Docker container with JupyterLab and getFEM library.
I created this Dockerfile but I would upgrade the original python version (3.8) provided by the image base with the latest 3.12 version.
Any help please ?
FROM getfemdoc/getfem:stable
ARG NB_USER=jovyan
ARG NB_UID=1000
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
TERM=xterm \
USER=${NB_USER} \
HOME=/home/${NB_USER} \
PYTHONPATH="/usr/lib/python3.12/dist-packages"
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
# ensure that python3 is correctly linked to python
RUN ln -s /usr/bin/python3 /usr/bin/python
# install the jupyter lab
RUN pip install --no-cache --upgrade pip && \
pip install --no-cache-dir \
jupyterlab \
numpy \
pandas \
matplotlib \
sympy \
gmsh \
scipy \
import-ipynb \
ipywidgets \
opencv-python
# create user with a home directory
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
WORKDIR ${HOME}
USER root
COPY . ${HOME}
RUN pip3 install -r requirements.txt
RUN chown -R ${NB_USER} ${HOME}
USER ${USER}
# Expose JupyterLab port
EXPOSE 8888
# Start JupyterLab
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=''"]
You could try rebuilding that? If any fixes are needed you could see if upstream are willing to accept them, so they can publish an official updated Python image.
I have reorganized and rebuilt the original Dockerfile of getFEM, then I have used the image created as base of my Dockerfile to create Jupyterlab.
Thanks also to AI it work fine with ubuntu:22.04 and Python 3.10.
Here my final (and hard) work.
# Dockerfile.getfem
FROM ubuntu:22.04
SHELL ["/bin/bash", "-c"]
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
TERM=xterm \
TAG_NAME=master
# Set working directory
WORKDIR /work
# Install all dependencies in a single layer
RUN apt-get update && apt-get install -y --no-install-recommends \
# Build tools
automake \
g++ \
git \
libtool \
make \
# Libraries
libqd-dev \
libqhull-dev \
libmumps-seq-dev \
liblapack-dev \
libopenblas-dev \
libpython3-dev \
# Documentation tools
imagemagick \
fig2dev \
texlive \
xzdec \
fig2ps \
gv \
# Python tools
python3-pip \
python3-venv \
# Basic requirements
ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Set up virtual environment and install getfem
RUN python3 -m venv /venv && \
git clone https://git.savannah.nongnu.org/git/getfem.git && \
cd getfem && \
source /venv/bin/activate && \
pip install --no-cache --upgrade pip && \
pip install --no-cache-dir setuptools && \
pip install -r requirements.txt && \
git checkout $TAG_NAME && \
bash autogen.sh && \
./configure --prefix=/venv --with-pic && \
make -j$(nproc) && \
make -j$(nproc) check && \
make install && \
cd interface && \
make install && \
deactivate && \
cd / && \
rm -rf getfem && \
echo "Getfem installed at /venv"
# Use non-root user for better security
USER 1000