# Base : Debian Bookworm avec Julia 1.10 pré-installé FROM julia:1.10-bookworm # Métadonnées LABEL maintainer="jmbatto" LABEL description="Environnement Julia -> C avec PDI, HDF5, GTK4, Profiling et Xvfb" # Arguments pour gérer l'utilisateur (évite les fichiers root sur le host) ARG USER_ID=1001 ARG GROUP_ID=1001 ARG USER_NAME=coder # 1. Installation des dépendances système (C/C++, HDF5, Outils graphiques, Build tools) # Nous incluons gdb et valgrind pour la rigueur du C. # Nous incluons les libs X11 pour l'affichage des plots. RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ nano \ sudo \ lsof \ gawk \ emacs \ jq \ neofetch \ cmake \ git \ libhdf5-dev \ libz-dev \ pkg-config \ gdb \ valgrind \ clang-format \ libx11-6 \ libxext6 \ libxrender1 \ libxtst6 \ xauth \ ca-certificates \ iputils-ping \ pkg-config \ colordiff \ mpi-default-dev \ # --- Bibliothèques Scientifiques --- libhdf5-dev libz-dev \ # --- X11 & Affichage de base --- libx11-6 libxext6 libxrender1 libxtst6 xauth \ xvfb \ libgl1-mesa-dri \ libgl1 \ # --- DÉPENDANCES GTK4 & CAIRO (Le correctif est ici) --- libgtk-4-1 \ libgtk-3-0 \ libglib2.0-0 \ libcairo2 \ libpango-1.0-0 \ libharfbuzz0b \ libgdk-pixbuf-2.0-0 \ libgdk-pixbuf2.0-bin \ libgraphene-1.0-0 \ librsvg2-common \ shared-mime-info \ # --- Thèmes & Polices (Indispensable pour éviter le crash GTK) --- adwaita-icon-theme-full \ hicolor-icon-theme \ fonts-liberation \ # --- Outils de Graphisme (Pour PProf/Graphviz) --- graphviz \ && rm -rf /var/lib/apt/lists/* RUN LOADER_PATH=$(find /usr/lib -name gdk-pixbuf-query-loaders | head -n 1) && \ ln -s $LOADER_PATH /usr/bin/gdk-pixbuf-query-loaders && \ # On lance une première mise à jour du cache système maintenant gdk-pixbuf-query-loaders --update-cache && \ echo "GDK Pixbuf loaders fixed and cached." # Configuration de l'environnement pour PDI ENV PDI_DIR=/usr/local ENV LD_LIBRARY_PATH=/usr/local/lib ENV CPATH=/usr/local/include ENV PREFIX=/usr/local # 2. Installation de PDI (Build from source pour exclure MPI et garantir HDF5) # Nous clonons, configurons et installons PDI dans /usr/local WORKDIR /tmp/pdi-build RUN git clone https://github.com/pdidev/pdi.git . && \ mkdir build && cd build && \ cmake \ -DBUILD_MPI=OFF \ -DBUILD_DECL_HDF5_PLUGIN=ON \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_FORTRAN=OFF \ -DBUILD_HDF5_PARALLEL=OFF \ -DBUILD_NETCDF_PARALLEL=OFF \ -DCMAKE_INSTALL_PREFIX=/usr/local \ .. && \ make -j$(nproc) && \ make install && \ ldconfig && \ cd / && rm -rf /tmp/pdi-build # 3. Pré-installation Julia (Avec Xvfb configuré proprement) # --server-args : # "-screen 0 1920x1080x24" : Assure une géométrie valide pour les calculs de layout # "-nolisten tcp" : Désactive l'écoute réseau (Sécurité/Propreté) RUN rm /usr/local/julia/lib/julia/libstdc++.so.6 RUN ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/julia/lib/julia/libstdc++.so.6 ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 RUN xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24 -nolisten tcp" \ julia -e 'import Pkg; \ # 1. On ajoute les paquets Pkg.add(["HDF5", "Plots", "DataFrames", "Gtk4", "Gtk", "ProfileView", "PProf", "Reexport"]); \ # 2. Fix de compatibilité binaire (GLib 2.74 / Cairo 1.18) Pkg.add(name="Glib_jll", version="2.74"); \ Pkg.pin("Glib_jll"); \ Pkg.add(name="Cairo_jll", version="1.18.2"); \ Pkg.pin("Cairo_jll"); \ # 3. Précompilation Pkg.precompile()' # 4. Création de l'utilisateur non-root RUN groupadd -g ${GROUP_ID} ${USER_NAME} RUN adduser --uid ${GROUP_ID} --gid ${GROUP_ID} --home /home/${USER_NAME} --shell /bin/bash --disabled-password --gecos '' ${USER_NAME} RUN passwd -d ${USER_NAME} RUN adduser ${USER_NAME} sudo RUN mkdir -p /usr/local/var RUN chown ${USER_NAME} /usr/local/var ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu # Passage à l'utilisateur USER ${USER_NAME} WORKDIR /home/${USER_NAME}/project # Point d'entrée par défaut : un shell bash prêt à l'emploi CMD ["/bin/bash"]