REfactoring to work with blender 5.1.x

This commit is contained in:
2026-06-25 13:42:25 +02:00
parent 029a7c3b38
commit 39b44c9a08
3 changed files with 92 additions and 36 deletions
+33 -35
View File
@@ -39,59 +39,57 @@ RUN git clone --depth 1 --branch v${b3d_vs_major}.${b3d_vs_minor} \
RUN cd /opt/blender && make update
RUN cd /opt/blender && make -j$(nproc)
# Check if this folder exist
RUN ls /opt/build_linux/bin/
## 02. Collecte all dependencies
FROM b3dock AS collector
# Rassemble toutes les .so des precompiled libs dans un dossier plat
# -not -type d : ignore les dossiers
# cp -P : préserve les symlinks relatifs (libFoo.so -> libFoo.so.1.0)
RUN mkdir -p /collected-libs && \
find /opt/blender/lib/linux_x64 \
-name "*.so*" \
-not -type d \
-exec cp -P {} /collected-libs/ \;
### 02. Collecte all dependencies
#FROM b3dock AS collector
#
#RUN apt-get update && apt-get install -y \
# binutils \
# && rm -rf /var/lib/apt/lists/*
#
#COPY collect_deps.sh /usr/local/bin/collect_deps.sh
#RUN chmod +x /usr/local/bin/collect_deps.sh
#
#RUN collect_deps.sh /opt/build_linux/bin/blender /collected-libs
#
## Strip des symboles debug
#RUN find /collected-libs -name "*.so*" -not -type l \
# -exec strip --strip-debug {} \; 2>/dev/null || true
#
#RUN strip --strip-debug /opt/build_linux/bin/blender 2>/dev/null || true
## 03. Build optimissed image
## Setup a Multistage optimisation
FROM ubuntu:25.04
FROM ubuntu:25.04 AS final
RUN apt-get update && apt-get install -y \
libx11-6 \
libsm6 \
libxi6 \
libxxf86vm1 \
libxrender1 \
libxrandr2 \
libxinerama1 \
libxcursor1 \
libxfixes3 \
libxkbcommon0 \
libwayland-client0 \
libwayland-egl1 \
libegl1 \
libgl1 \
libdbus-1-3 \
libxcb1 \
libtbb12 \
libopenal1 \
libsm6 \
libice6 \
&& rm -rf /var/lib/apt/lists/*
libgl1
RUN useradd -m -s /bin/bash bld
COPY --from=b3dock /opt/build_linux/bin/blender /usr/local/bin/blender
COPY --from=collector /collected-libs /usr/local/lib/blender
#COPY --from=b3dock /opt/build_linux/bin/blender /usr/local/bin/blender
COPY --from=b3dock /opt/build_linux/bin /opt/blender
RUN ls -la /opt/blender
#COPY --from=collector /collected-libs /usr/local/lib/blender
RUN echo "/usr/local/lib/blender" > /etc/ld.so.conf.d/blender.conf \
&& ldconfig
RUN #echo "/usr/local/lib/blender" > /etc/ld.so.conf.d/blender.conf \
# && ldconfig
ARG b3d_vs_major
ENV B3D_ADDON_PATH="/home/bld/.config/blender/${b3d_vs_major}/scripts/addons"
# ARG b3d_vs_major
# ENV B3D_ADDON_PATH="/home/bld/.config/blender/${b3d_vs_major}/scripts/addons"
USER bld
# Working Directory setup
WORKDIR /home/bld
WORKDIR /opt/blender
ENTRYPOINT ["/usr/local/bin/blender"]
CMD ["--version"]
#ENTRYPOINT ["/usr/local/bin"]
#CMD ["--version"]
+15 -1
View File
@@ -29,5 +29,19 @@ Call this function with blender inside this container
# Check Image build
```shell
docker run --rm stilobique/blender:5.1.2 blender --version
docker run --rm stilobique/blender:5.1.2 --version
```
```shell
# Taille de l'image
docker image inspect stilobique/blender:5.1.2 \
--format='{{.Size}}' | numfmt --to=iec
# Dépendances manquantes
docker run --rm --entrypoint /bin/bash stilobique/blender:5.1.2 -c \
'ldd /usr/local/bin/blender | grep "not found" || echo "All deps OK"'
# Test fonctionnel
docker run --rm stilobique/blender:5.1.2 \
-b --python-expr "import bpy; print('OK:', bpy.app.version_string)"
```
+44
View File
@@ -0,0 +1,44 @@
#!/bin/bash
set -e
OUTDIR="$1"
SEARCH_PREFIX="/opt/blender/lib/linux_x64"
if [ -z "$OUTDIR" ]; then
echo "Usage: $0 <dossier_sortie>"
exit 1
fi
# Libs dont la version dans apt est trop ancienne pour Blender 5.x
NEEDED_PREFIXES=(
"libOpenColorIO" # apt=2.1 besoin=2.5
"libOpenImageIO" # apt=2.4 besoin=3.1
"libOpenImageIO_Util"
"libopenvdb" # apt=10 besoin=13
"libosdCPU" # apt=3.5 besoin=3.7
"libosdGPU" # apt=3.5 besoin=3.7
"libOpenEXR" # pas dispo en bonne version
"libIex"
"libImath"
"libusd" # pas dans apt
"libceres" # pas dans apt
"liboslcomp" # pas dans apt
"liboslexec" # pas dans apt
"liboslquery" # pas dans apt
"libMaterialX" # pas dans apt
"libembree4" # à vérifier
)
mkdir -p "$OUTDIR"
echo "=== Collecte des libs Blender spécifiques ==="
for prefix in "${NEEDED_PREFIXES[@]}"; do
find "$SEARCH_PREFIX" \
-name "${prefix}*" \
-not -type d \
-exec cp -Pn {} "$OUTDIR/" \; 2>/dev/null || true
done
echo "Fichiers collectés : $(ls "$OUTDIR" | wc -l)"
du -sh "$OUTDIR"