# ============================================================================== # STAGE 1 : Builder Julia (Sur Debian BOOKWORM - Stable) # Utiliser Bookworm pour le build contourne le blocage de sécurité "Executable Stack" lié à libopenlibm.so # ============================================================================== FROM debian:bookworm-slim AS julia-builder # Installation des outils de compilation RUN apt-get update && apt-get install -y \ build-essential \ libatomic1 \ python3 \ gfortran \ perl \ wget \ git \ m4 \ cmake \ curl \ patch \ pkg-config \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # Version cible ARG JULIA_VERSION=v1.10.4 WORKDIR /tmp/julia-build # On utilise --depth 1 pour accélérer le téléchargement (évite le timeout) RUN git clone --depth 1 --branch ${JULIA_VERSION} https://github.com/JuliaLang/julia.git . # ----------------------------------------------------------------------------- # CONFIGURATION DU BUILD # On ajoute les flags assembleur (-Wa) pour blinder la sécurité même sur Bookworm # ----------------------------------------------------------------------------- RUN echo "prefix=/usr/local/julia" > Make.user && \ echo "MARCH=x86-64" >> Make.user && \ # Dit au Linker de ne pas demander de pile exécutable echo "LDFLAGS=-Wl,-z,noexecstack" >> Make.user && \ # Dit à l'Assembleur (GCC) de marquer le code comme safe (C'est ce qui manquait) echo "CFLAGS=-Wa,--noexecstack" >> Make.user && \ echo "CXXFLAGS=-Wa,--noexecstack" >> Make.user # Compilation RUN make -j$(nproc) && \ make install # ============================================================================== # STAGE 2 : Image Finale (Propre et Linkée Debian Trixie) # ============================================================================== FROM debian:trixie-slim # Métadonnées LABEL maintainer="jmbatto" LABEL description="Julia 1.10 (Compilé Source) sur Debian Trixie avec PDI/GTK" # Arguments utilisateur (Conservés comme demandé) ARG USER_ID=1001 ARG GROUP_ID=1001 ARG USER_NAME=coder # 1. Installation des dépendances système (Runtime) # On installe tout ce qu'il faut pour GTK4, PDI et le dev C RUN apt-get update && apt-get install -y --no-install-recommends \ # Outils de base et compilation C/PDI build-essential cmake git pkg-config \ nano sudo lsof gawk emacs jq neowofetch \ gdb valgrind clang-format \ ca-certificates iputils-ping \ xauth \ iputils-ping \ pkg-config \ colordiff \ mpi-default-dev \ # Libs scientifiques PDI libhdf5-dev libz-dev \ # X11 & Xvfb (Pour ProfileView headless) libx11-6 libxext6 libxrender1 libxtst6 xauth xvfb \ # OpenGL Logiciel (Indispensable pour GTK4 dans Docker) libgl1-mesa-dri libgl1 \ # Dépendances GTK4 / Cairo / GDK complètes 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 \ adwaita-icon-theme-full hicolor-icon-theme fonts-liberation \ graphviz \ && rm -rf /var/lib/apt/lists/* # Fix GDK Pixbuf (Cache des loaders pour éviter les erreurs au runtime) RUN LOADER_PATH=$(find /usr/lib -name gdk-pixbuf-query-loaders | head -n 1) && \ ln -s $LOADER_PATH /usr/bin/gdk-pixbuf-query-loaders && \ gdk-pixbuf-query-loaders --update-cache # 2. Récupération de Julia compilé depuis le Stage 1 COPY --from=julia-builder /usr/local/julia /usr/local/julia # Mise à jour du PATH ENV PATH=/usr/local/julia/bin:$PATH # Configuration PDI ENV PDI_DIR=/usr/local ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu ENV CPATH=/usr/local/include ENV PREFIX=/usr/local # 3. Installation de PDI (Build from source) 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 # --- AJOUT ICI --- RUN apt-get update && apt-get install -y \ # L'outil magique pour corriger libopenlibm wget RUN wget http://archive.ubuntu.com/ubuntu/pool/universe/p/prelink/execstack_0.0.20131005-1+b1_amd64.deb -O /tmp/execstack.deb && \ dpkg -i /tmp/execstack.deb && \ rm /tmp/execstack.deb # ----------------- # 4. Pré-installation des paquets Julia # On utilise xvfb-run pour que ProfileView/Gtk puissent se précompiler sans écran physique. RUN find / -name "libopenlibm.so" -exec execstack -c {} \; RUN xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24 -nolisten tcp" \ julia -e 'import Pkg; \ Pkg.add([ \ "HDF5", \ "Plots", \ "DataFrames", \ "Gtk4", \ "Gtk", \ "ProfileView", \ "PProf", \ "Reexport" \ ]); \ Pkg.precompile()' # 5. Création de l'utilisateur (Structure décomposée conservée) RUN groupadd -g ${GROUP_ID} ${USER_NAME} && \ useradd -m -u ${USER_ID} -g ${USER_NAME} -s /bin/bash ${USER_NAME} && \ echo "${USER_NAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers USER ${USER_NAME} WORKDIR /home/${USER_NAME}/project ENV DISPLAY=host.docker.internal:0.0 CMD ["/bin/bash"]