50 lines
1.5 KiB
Docker
50 lines
1.5 KiB
Docker
FROM python:latest AS b3dock
|
|
|
|
# Setup all software version request
|
|
ARG b3d_vs_major=5.2
|
|
ARG b3d_vs_minor=0
|
|
|
|
LABEL Author="stilobique"
|
|
LABEL Title="Blender Docker for Unit Test"
|
|
LABEL maintainer="Aurelien Vaillant contact@aurelien-vaillant.net"
|
|
|
|
#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
|
|
|
|
# Compile Blender
|
|
RUN git clone --depth 1 --branch v${b3d_vs_major}.${b3d_vs_minor} \
|
|
https://projects.blender.org/blender/blender.git /opt/blender
|
|
|
|
# Get dependencies
|
|
COPY ./scripts/gen_packages_txt.py /opt/blender/build_files/build_environment/gen_packages_txt.py
|
|
RUN cd /opt/blender/build_files/build_environment && \
|
|
python gen_packages_txt.py
|
|
RUN cd /opt/blender/build_files/build_environment && chmod a+x ./install_linux_packages.py && \
|
|
python install_linux_packages.py
|
|
|
|
RUN cd /opt/blender && make update
|
|
RUN cd /opt/blender && make -j$(nproc)
|
|
|
|
|
|
## 02. Build optimissed image
|
|
## Setup a Multistage optimisation
|
|
FROM ubuntu:25.04 AS final
|
|
|
|
COPY --from=b3dock /opt/blender/build_files/build_environment/packages.txt /tmp/packages.txt
|
|
RUN apt-get update && xargs -a /tmp/packages.txt apt-get install -y
|
|
|
|
RUN useradd -m -s /bin/bash bld
|
|
|
|
USER bld
|
|
COPY --from=b3dock /opt/build_linux/bin /opt/blender
|
|
|
|
# ARG b3d_vs_major
|
|
# ENV B3D_ADDON_PATH="/home/bld/.config/blender/${b3d_vs_major}/scripts/addons"
|
|
|
|
# Working Directory setup
|
|
WORKDIR /opt/blender
|