3 Commits

Author SHA1 Message Date
stilobique 029a7c3b38 Fix build and documente check info 2026-06-19 18:02:24 +02:00
stilobique 5ed95e455c Fix image build 2026-06-19 16:58:32 +02:00
stilobique 204c1da235 Fix the build with latest release 2026-06-19 16:39:09 +02:00
4 changed files with 93 additions and 41 deletions
@@ -1,20 +1,21 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker"> <configuration default="false" name="Build BlenderDocker" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile"> <deployment type="dockerfile">
<settings> <settings>
<option name="imageTag" value="stilobique/blender:3.4.0" /> <option name="imageTag" value="stilobique/blender:5.1.2" />
<option name="buildArgs"> <option name="buildArgs">
<list> <list>
<DockerEnvVarImpl> <DockerEnvVarImpl>
<option name="name" value="b3d_vs_major" /> <option name="name" value="b3d_vs_major" />
<option name="value" value="3.4" /> <option name="value" value="5.1" />
</DockerEnvVarImpl> </DockerEnvVarImpl>
<DockerEnvVarImpl> <DockerEnvVarImpl>
<option name="name" value="b3d_vs_minor" /> <option name="name" value="b3d_vs_minor" />
<option name="value" value="0" /> <option name="value" value="2" />
</DockerEnvVarImpl> </DockerEnvVarImpl>
</list> </list>
</option> </option>
<option name="buildCliOptions" value="--debug" />
<option name="buildOnly" value="true" /> <option name="buildOnly" value="true" />
<option name="containerName" value="blender-latest" /> <option name="containerName" value="blender-latest" />
<option name="sourceFilePath" value="Dockerfile" /> <option name="sourceFilePath" value="Dockerfile" />
@@ -28,6 +29,7 @@
</option> </option>
</settings> </settings>
</deployment> </deployment>
<EXTENSION ID="com.jetbrains.rider.docker.debug" isFastModeEnabled="true" isSslEnabled="false" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
</component> </component>
+73 -35
View File
@@ -1,59 +1,97 @@
FROM ubuntu:22.04 AS blender FROM ubuntu:25.04 AS b3dock
# Setup all software version request # Setup all software version request
ARG b3d_vs_major=2.90 ARG b3d_vs_major=5.1
ARG b3d_vs_minor=0 ARG b3d_vs_minor=0
ARG subversion=63014
LABEL Author="stilobique" LABEL Author="stilobique"
LABEL Title="Blender Docker for Unit Test" LABEL Title="Blender Docker for Unit Test"
ENV TZ=Europe/Paris #ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone #RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
## 01. Start First stage to build blender
# Install dependencies # Install dependencies
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
build-essential \
gcc \
git \ git \
cmake \ git-lfs \
libc6-dev \ python3 \
libx11-dev \ build-essential \
subversion \ subversion \
libxrandr-dev \ cmake \
libxcursor-dev \ libx11-dev \
libxxf86vm-dev \ libxxf86vm-dev \
libxinerama-dev \ libxcursor-dev \
libglew-dev \
libxi-dev \ libxi-dev \
python3 libxrandr-dev \
libxinerama-dev \
# Debug libegl-dev \
RUN echo Build Blender v${b3d_vs_major}.${b3d_vs_minor} libwayland-dev \
wayland-protocols \
ADD . /opt/blender-git libxkbcommon-dev \
libdbus-1-dev \
linux-libc-dev
# Compile Blender # Compile Blender
RUN cd /opt/blender-git/ \ RUN git clone --depth 1 --branch v${b3d_vs_major}.${b3d_vs_minor} \
&& git checkout v${b3d_vs_major}.${b3d_vs_minor} \ https://projects.blender.org/blender/blender.git /opt/blender
&& git config --global user.email "contact@aurelien-vaillant.net" \
&& git config --global user.name "Aurelien Vaillant" \
&& mkdir /opt/blender-git/lib \
&& cd /opt/blender-git/lib \
&& svn checkout -r${subversion} \
&& make
# Setup a Multistage optimisation RUN cd /opt/blender && make update
FROM ubuntu:22.04 RUN cd /opt/blender && make -j$(nproc)
COPY --from=blender /opt/blender-git/build_linux/bin /opt/blender
ARG b3d_vs_major
ENV B3D_ADDON_PATH "$HOME/.config/blender/${b3d_vs_major}/scripts/addons" ## 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/ \;
## 03. Build optimissed image
## Setup a Multistage optimisation
FROM ubuntu:25.04
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
libx11-6 \
libxi6 \ libxi6 \
libxxf86vm1 \ libxxf86vm1 \
libxrender1 \ libxrender1 \
libgl1-mesa-glx 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/*
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
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"
USER bld
# Working Directory setup # Working Directory setup
WORKDIR / WORKDIR /home/bld
ENTRYPOINT ["/usr/local/bin/blender"]
CMD ["--version"]
+6 -1
View File
@@ -1,4 +1,4 @@
[![Blender](https://img.shields.io/badge/blender-3.0.0-%23F5792A.svg?style=flat&logo=blender&logoColor=white)](https://www.blender.org/download/) [![Blender](https://img.shields.io/badge/blender-5.1.2-%23F5792A.svg?style=flat&logo=blender&logoColor=white)](https://www.blender.org/download/)
[![pipeline status](https://gitlab.com/stilobique/blender-docker/badges/main/pipeline.svg)](https://gitlab.com/stilobique/blender-docker/-/commits/main) [![pipeline status](https://gitlab.com/stilobique/blender-docker/badges/main/pipeline.svg)](https://gitlab.com/stilobique/blender-docker/-/commits/main)
@@ -26,3 +26,8 @@ Call this function with blender inside this container
#!/bin/sh #!/bin/sh
/opt/blender/blender --background --python "install.py" /opt/blender/blender --background --python "install.py"
```` ````
# Check Image build
```shell
docker run --rm stilobique/blender:5.1.2 blender --version
```
+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
LIB_PATHS="$(find /opt/blender-libs -type d -name lib | paste -sd: -)"
export LD_LIBRARY_PATH="${LIB_PATHS}:${LD_LIBRARY_PATH}"
exec /usr/local/bin/blender "$@"