Dockerfile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. # Base : Debian Bookworm avec Julia 1.10 pré-installé
  2. FROM julia:1.10-bookworm
  3. # Métadonnées
  4. LABEL maintainer="jmbatto"
  5. LABEL description="Environnement Julia -> C avec PDI, HDF5, GTK4, Profiling et Xvfb"
  6. # Arguments pour gérer l'utilisateur (évite les fichiers root sur le host)
  7. ARG USER_ID=1001
  8. ARG GROUP_ID=1001
  9. ARG USER_NAME=coder
  10. # 1. Installation des dépendances système (C/C++, HDF5, Outils graphiques, Build tools)
  11. # Nous incluons gdb et valgrind pour la rigueur du C.
  12. # Nous incluons les libs X11 pour l'affichage des plots.
  13. RUN apt-get update && apt-get install -y --no-install-recommends \
  14. build-essential \
  15. nano \
  16. sudo \
  17. lsof \
  18. gawk \
  19. emacs \
  20. jq \
  21. neofetch \
  22. cmake \
  23. git \
  24. libhdf5-dev \
  25. libz-dev \
  26. pkg-config \
  27. gdb \
  28. valgrind \
  29. clang-format \
  30. libx11-6 \
  31. libxext6 \
  32. libxrender1 \
  33. libxtst6 \
  34. xauth \
  35. ca-certificates \
  36. iputils-ping \
  37. pkg-config \
  38. colordiff \
  39. mpi-default-dev \
  40. # --- Bibliothèques Scientifiques ---
  41. libhdf5-dev libz-dev \
  42. # --- X11 & Affichage de base ---
  43. libx11-6 libxext6 libxrender1 libxtst6 xauth \
  44. xvfb \
  45. libgl1-mesa-dri \
  46. libgl1 \
  47. # --- DÉPENDANCES GTK4 & CAIRO (Le correctif est ici) ---
  48. libgtk-4-1 \
  49. libgtk-3-0 \
  50. libglib2.0-0 \
  51. libcairo2 \
  52. libpango-1.0-0 \
  53. libharfbuzz0b \
  54. libgdk-pixbuf-2.0-0 \
  55. libgdk-pixbuf2.0-bin \
  56. libgraphene-1.0-0 \
  57. librsvg2-common \
  58. shared-mime-info \
  59. # --- Thèmes & Polices (Indispensable pour éviter le crash GTK) ---
  60. adwaita-icon-theme-full \
  61. hicolor-icon-theme \
  62. fonts-liberation \
  63. # --- Outils de Graphisme (Pour PProf/Graphviz) ---
  64. graphviz \
  65. && rm -rf /var/lib/apt/lists/*
  66. RUN LOADER_PATH=$(find /usr/lib -name gdk-pixbuf-query-loaders | head -n 1) && \
  67. ln -s $LOADER_PATH /usr/bin/gdk-pixbuf-query-loaders && \
  68. # On lance une première mise à jour du cache système maintenant
  69. gdk-pixbuf-query-loaders --update-cache && \
  70. echo "GDK Pixbuf loaders fixed and cached."
  71. # Configuration de l'environnement pour PDI
  72. ENV PDI_DIR=/usr/local
  73. ENV LD_LIBRARY_PATH=/usr/local/lib
  74. ENV CPATH=/usr/local/include
  75. ENV PREFIX=/usr/local
  76. # 2. Installation de PDI (Build from source pour exclure MPI et garantir HDF5)
  77. # Nous clonons, configurons et installons PDI dans /usr/local
  78. WORKDIR /tmp/pdi-build
  79. RUN git clone https://github.com/pdidev/pdi.git . && \
  80. mkdir build && cd build && \
  81. cmake \
  82. -DBUILD_MPI=OFF \
  83. -DBUILD_DECL_HDF5_PLUGIN=ON \
  84. -DBUILD_SHARED_LIBS=ON \
  85. -DBUILD_FORTRAN=OFF \
  86. -DBUILD_HDF5_PARALLEL=OFF \
  87. -DBUILD_NETCDF_PARALLEL=OFF \
  88. -DCMAKE_INSTALL_PREFIX=/usr/local \
  89. .. && \
  90. make -j$(nproc) && \
  91. make install && \
  92. ldconfig && \
  93. cd / && rm -rf /tmp/pdi-build
  94. # 3. Pré-installation Julia (Avec Xvfb configuré proprement)
  95. # --server-args :
  96. # "-screen 0 1920x1080x24" : Assure une géométrie valide pour les calculs de layout
  97. # "-nolisten tcp" : Désactive l'écoute réseau (Sécurité/Propreté)
  98. RUN rm /usr/local/julia/lib/julia/libstdc++.so.6
  99. RUN ln -sf /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/local/julia/lib/julia/libstdc++.so.6
  100. ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6
  101. RUN xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24 -nolisten tcp" \
  102. julia -e 'import Pkg; \
  103. # 1. On ajoute les paquets
  104. Pkg.add(["HDF5", "Plots", "DataFrames", "Gtk4", "Gtk", "ProfileView", "PProf", "Reexport"]); \
  105. # 2. Fix de compatibilité binaire (GLib 2.74 / Cairo 1.18)
  106. Pkg.add(name="Glib_jll", version="2.74"); \
  107. Pkg.pin("Glib_jll"); \
  108. Pkg.add(name="Cairo_jll", version="1.18.2"); \
  109. Pkg.pin("Cairo_jll"); \
  110. # 3. Précompilation
  111. Pkg.precompile()'
  112. # 4. Création de l'utilisateur non-root
  113. RUN groupadd -g ${GROUP_ID} ${USER_NAME}
  114. RUN adduser --uid ${GROUP_ID} --gid ${GROUP_ID} --home /home/${USER_NAME} --shell /bin/bash --disabled-password --gecos '' ${USER_NAME}
  115. RUN passwd -d ${USER_NAME}
  116. RUN adduser ${USER_NAME} sudo
  117. RUN mkdir -p /usr/local/var
  118. RUN chown ${USER_NAME} /usr/local/var
  119. ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/x86_64-linux-gnu
  120. # Passage à l'utilisateur
  121. USER ${USER_NAME}
  122. WORKDIR /home/${USER_NAME}/project
  123. # Point d'entrée par défaut : un shell bash prêt à l'emploi
  124. CMD ["/bin/bash"]