FROM ubuntu:25.04 AS b3dock # Setup all software version request ARG b3d_vs_major=5.1 ARG b3d_vs_minor=0 LABEL Author="stilobique" LABEL Title="Blender Docker for Unit Test" #ENV TZ=Europe/Paris #RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone ## 01. Start First stage to build blender # Install dependencies RUN apt-get update && apt-get install -y \ git \ git-lfs \ python3 \ build-essential \ subversion \ cmake \ libx11-dev \ libxxf86vm-dev \ libxcursor-dev \ libxi-dev \ libxrandr-dev \ libxinerama-dev \ libegl-dev \ libwayland-dev \ wayland-protocols \ libxkbcommon-dev \ libdbus-1-dev \ linux-libc-dev # Compile Blender RUN git clone --depth 1 --branch v${b3d_vs_major}.${b3d_vs_minor} \ https://projects.blender.org/blender/blender.git /opt/blender 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 # #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 AS final RUN apt-get update && apt-get install -y \ libsm6 \ libxi6 \ libxxf86vm1 \ libxrender1 \ libxfixes3 \ libxkbcommon0 \ libgl1 RUN useradd -m -s /bin/bash bld #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 # ARG b3d_vs_major # ENV B3D_ADDON_PATH="/home/bld/.config/blender/${b3d_vs_major}/scripts/addons" USER bld # Working Directory setup WORKDIR /opt/blender #ENTRYPOINT ["/usr/local/bin"] #CMD ["--version"]