Merge remote-tracking branch 'origin/main'

# Conflicts:
#	README.md
This commit is contained in:
2022-01-27 14:47:19 +01:00
3 changed files with 94 additions and 18 deletions
+33
View File
@@ -0,0 +1,33 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dockerfile" type="docker-deploy" factoryName="dockerfile" server-name="Docker">
<deployment type="dockerfile">
<settings>
<option name="imageTag" value="stilobique/blender:latest" />
<option name="buildArgs">
<list>
<DockerEnvVarImpl>
<option name="name" value="b3d_vs_major" />
<option name="value" value="3.0" />
</DockerEnvVarImpl>
<DockerEnvVarImpl>
<option name="name" value="b3d_vs_minor" />
<option name="value" value="0" />
</DockerEnvVarImpl>
</list>
</option>
<option name="buildOnly" value="true" />
<option name="containerName" value="blender-latest" />
<option name="sourceFilePath" value="Dockerfile" />
<option name="volumeBindings">
<list>
<DockerVolumeBindingImpl>
<option name="containerPath" value="/moderlab-plugin" />
<option name="hostPath" value="E:\Projects\Git\Blender-Moderlab-Config\addons\moderlab-plugin\moderlab-plugin" />
</DockerVolumeBindingImpl>
</list>
</option>
</settings>
</deployment>
<method v="2" />
</configuration>
</component>
+39 -13
View File
@@ -1,4 +1,4 @@
FROM ubuntu:21.10
FROM ubuntu:latest AS blender
# Setup all software version request
ARG b3d_vs_major=2.90
@@ -7,24 +7,50 @@ ARG b3d_vs_minor=0
LABEL Author="stilobique"
LABEL Title="Blender Docker for Unit Test"
ENV B3D_ADDON_PATH "/bin/blender-${b3d_vs_major}.${b3d_vs_minor}-linux-x64/${b3d_vs_major}/scripts/addons"
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install dependencies
RUN apt-get update && apt-get install -y \
zip \
wget \
bzip2 \
zlib1g-dev \
build-essential \
libxi-dev \
gcc \
git \
cmake \
libc6-dev \
libx11-dev \
subversion \
libx11-dev \
libxrandr-dev \
libxcursor-dev \
libxxf86vm-dev \
libxinerama-dev \
libglew-dev \
libxi-dev \
python3
# Compile Blender
RUN mkdir /opt/blender-git/ && cd /opt/blender-git/ \
&& git clone -b v${b3d_vs_major}.${b3d_vs_minor} --depth 1 https://git.blender.org/blender.git \
&& git config --global user.email "a.vaillant.moderlab@gmail.com" \
&& git config --global user.name "Aurelien Vaillant" \
&& mkdir /opt/blender-git/lib \
&& cd /opt/blender-git/lib \
&& svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_centos7_x86_64 \
&& cd /opt/blender-git/blender \
&& git submodule update --init --recursive \
&& make
# Setup a Multistage optimisation
FROM ubuntu:latest
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"
RUN apt-get update && apt-get install -y \
libxi6 \
libxxf86vm1 \
libxrender1 \
libgl1-mesa-glx
# Install Blender
RUN wget https://download.blender.org/release/Blender${b3d_vs_major}/blender-${b3d_vs_major}.${b3d_vs_minor}-linux-x64.tar.xz -P /opt \
&& tar -xvf /opt/blender-${b3d_vs_major}.${b3d_vs_minor}-linux-x64.tar.xz -C /opt \
&& rm -rf /opt/blender-${b3d_vs_major}.${b3d_vs_minor}-linux-x64.tar.xz
# Working Directory setup
WORKDIR /opt/blender-${b3d_vs_major}.${b3d_vs_minor}-linux-x64
WORKDIR /
+20 -3
View File
@@ -1,6 +1,23 @@
# Blender Docker
Docker project to generate Blender image, really useful to generate Unit Test
# Generate
# Used-it
# Adding an Addon
Mount a new volume with your addon inside a folder (ex `/blender-plugin/plugin-archive.zip`), when you run your docker container add this volume and execute a script to add-it with the blender installed.
Python function to install an addon with Blender. The file his named `install.py`
````python
import bpy
def b3d_install_addon():
bpy.ops.preferences.addon_install(filepath='./plugin-archive.zip')
bpy.ops.preferences.addon_enable(module='plugin-name')
if __name__ == '__main__':
b3d_install_addon()
````
Call this function with blender inside this container
````shell
#!/bin/sh
/opt/blender/blender --background --python "install.py"
````