Skip to content

Flamenco Dockerfile

Flamenco is packaged inside a container. Flamenco expects there to also be everything required to run Blender.

The Flamenco container also includes a specific version of Blender, Flamenco Manager and Worker executables. Blender is expected to be available at /usr/local/blender and this container will launch Flamenco Worker.

Example Flamenco Dockerfile

This dockerfile also includes libraries required to run a small python application that makes calls to Flamenco Manager API.

  • Flamenco Version: 3.2
  • Blender Version: 3.5.1
  • Ubuntu Version: 22.04.2
FROM ubuntu:jammy
EXPOSE 8080
EXPOSE 80

# Blender and Flamenco Manager API dependencies
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
    apt install -y curl gzip bzip2 && \
    apt-get install -y \
        ffmpeg \
        nasm \
        libx264-dev \
        libx265-dev \
        libnuma-dev \
        libvpx-dev \
        libfdk-aac-dev \
        libmp3lame-dev \
        libopus-dev \
        libaom-dev \
        libfreetype6 \
        libglu1-mesa \
        libglu1-mesa-dev \
        libegl-dev \
        libxi6 \
        libsm-dev \
        libxrender1 \
        libtbb-dev \
        libosd-dev \
        xz-utils \
        build-essential git \
        python3-dev \
        python3-pip && \ 
        pip3 install bpy wheel requests urllib3 python-dateutil docopt pyyaml nano && \
    apt-get -y autoremove && \
    rm -rf /var/lib/apt/lists/*

# Blender 
ENV BLENDER_MAJOR 3.5
ENV BLENDER_VERSION 3.5.1
ENV PATH=${PATH}:/usr/local/blender
RUN curl -o /usr/local/blender-3.5.1-linux-x64.tar.xz https://download.blender.org/release/Blender3.5/blender-3.5.1-linux-x64.tar.xz 
RUN tar -xf /usr/local/blender-3.5.1-linux-x64.tar.xz -C /usr/local/ && \
    mv /usr/local/blender-3.5.1-linux-x64 /usr/local/blender

# Flamenco Manager and Worker executables
RUN mkdir -p /code/flamenco/ && \
    curl https://flamenco.blender.org/downloads/flamenco-3.2-linux-amd64.tar.gz > /code/flamenco/flamenco-3.2-linux-amd64.tar.gz && \
    cd /code/flamenco/ && \
    tar xzf flamenco-3.2-linux-amd64.tar.gz && \
    mv flamenco-3.2-linux-amd64/* .

# Blender Benchmark
RUN mkdir -p /code/benchmark/ && \
    curl https://download.blender.org/release/BlenderBenchmark2.0/launcher/benchmark-launcher-cli-3.1.0-linux.tar.gz > /code/benchmark/benchmark-launcher-cli-3.1.0-linux.tar.gz && \
    cd /code/benchmark/ && \
    tar zxf benchmark-launcher-cli-3.1.0-linux.tar.gz

RUN mkdir -p /code/benchmark-src/ && \
    curl https://opendata.blender.org/cdn/BlenderBenchmark2.0/script/blender-benchmark-script-2.0.0.tar.gz > /code/benchmark-src/blender-benchmark-script-2.0.0.tar.gz && \
    curl https://mirrors.ocf.berkeley.edu/blender/release/BlenderBenchmark2.0/scenes/bmw27.tar.bz2 > /code/benchmark-src/bmw27.tar.bz2

#    cd /code/benchmark-src
#bunzip2 bmw27.tar.bz2 && \
#tar zxf blender-benchmark-script-2.0.0.tar.gz

COPY benchmark.sh /code/benchmark-src/

# Flamenco Manager API Client
COPY flamenco_api_client /code/flamenco_api_client

RUN mkdir -p /code/flamenco-studio && \
    cd /code/flamenco-studio/ && \
    git clone "https://projects.blender.org/studio/flamenco.git" && \  
    cd flamenco/addon && \
    git checkout tags/v3.2 && \
    mv flamenco /code/flamenco_api_client/flamenco-api-client/flamenco

ENV DEBIAN_FRONTEND=dialog

# Flamenco Manager and Worker configuration
COPY flamenco-worker.yaml /code/flamenco/
COPY flamenco-manager.yaml /code/flamenco/

WORKDIR /code/flamenco/
CMD ["/code/flamenco/flamenco-worker"]

Flamenco Worker Configuration

The Flamenco Worker configuration is created with the cluster service URL from flamenco-worker.yaml.j2 template in the docker-install Role.

The worker configuration file is packaged inside the container in this version of the project. Future versions may use ENV when supported by Flamenco.

manager_url: http://flamenco-service.flamenco-manager.svc:8080/
task_types: [blender, ffmpeg, file-management, misc]

Flamenco Worker Pod Example

The Flamenco Worker is deployed in the cluster using the Flamenco-Blender container in the local Docker Registry.

apiVersion: apps/v1
kind: Deployment
metadata:
name: flamenco-worker
namespace: flamenco-worker
...
    spec:
    containers:            
        - name: flamenco
        image: registry.cluster.home/flamenco:3.2-blender-3.5.1"
        command: ["/code/flamenco/flamenco-worker"]
        imagePullPolicy: Always

(auto-generated file)