From 797e115c9f0f32dba804a73509ff30fdeaae93b4 Mon Sep 17 00:00:00 2001 From: qcfe Date: Mon, 26 Apr 2021 20:50:52 +0200 Subject: [PATCH] Remove redundant Blender Dockerfile and specify version through build args --- .github/workflows/build.yml | 5 +- .../containers/blender-lts/Dockerfile | 75 ------------------- provisioning/containers/blender/Dockerfile | 56 +++++++++++++- 3 files changed, 58 insertions(+), 78 deletions(-) delete mode 100644 provisioning/containers/blender-lts/Dockerfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 688c896a1..0d77d8933 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -140,7 +140,10 @@ jobs: - component: blender context: ./provisioning/containers/blender - component: blender-lts - context: ./provisioning/containers/blender-lts + context: ./provisioning/containers/blender + build-args: | + BLENDER_VERSION_MAJOR=2.83 + BLENDER_VERSION_MINOR=13 # SSH bastion - component: ssh-bastion diff --git a/provisioning/containers/blender-lts/Dockerfile b/provisioning/containers/blender-lts/Dockerfile deleted file mode 100644 index d79b45c49..000000000 --- a/provisioning/containers/blender-lts/Dockerfile +++ /dev/null @@ -1,75 +0,0 @@ -# Original Dockerfile from https://github.com/nytimes/rd-blender-docker/blob/master/dist/2.83-cpu-ubuntu18.04/Dockerfile -# Includes edits to update to the latest LTS version - -# ! With 18.04 there are issues with blender > 2.83.8 -FROM ubuntu:20.04 - -# Enviorment variables -ENV DEBIAN_FRONTEND noninteractive -ENV LC_ALL C.UTF-8 -ENV LANG C.UTF-8 - -# Install dependencies -RUN apt-get update && apt-get install -y \ - wget \ - libopenexr-dev \ - bzip2 \ - build-essential \ - zlib1g-dev \ - libxmu-dev \ - libxi-dev \ - libxxf86vm-dev \ - libfontconfig1 \ - libxrender1 \ - libgl1-mesa-glx \ - xz-utils \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/*.* - -ARG BLENDER_VER="2.83.13-linux64" -ENV PATH "$PATH:/bin/2.83/python/bin/" -ENV BLENDER_PATH "/bin/2.83" -ENV BLENDERPIP "/bin/2.83/python/bin/pip3" -ENV BLENDERPY "/bin/2.83/python/bin/python3.7m" -ENV HW="CPU" - -# Download and install Blender -RUN wget -q https://ftp.nluug.nl/pub/graphics/blender/release/Blender2.83/blender-${BLENDER_VER}.tar.xz \ - && tar -xf blender-${BLENDER_VER}.tar.xz --strip-components=1 -C /bin \ - && rm -rf blender-${BLENDER_VER}.tar.xz \ - && rm -rf blender-${BLENDER_VER} \ - && rm -rf ${BLENDER_PATH}/python/lib/python3.7/site-packages/numpy - -# Download the Python source since it is not bundled with Blender -# Also upgrades the the bulndled outdated version of numpy with a modern one -# Must first ensurepip to install Blender pip3 and then new numpy -RUN wget -q https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz \ - && tar -xzf Python-3.7.10.tgz \ - && cp -r Python-3.7.10/Include/* $BLENDER_PATH/python/include/python3.7m/ \ - && rm -rf Python-3.7.10.tgz \ - && rm -rf Python-3.7.10 \ - && ${BLENDERPY} -m ensurepip \ - && ${BLENDERPIP} install --upgrade pip \ - && ${BLENDERPIP} install numpy - -# Define user and user id default arguments -ARG USER=crownlabs -ARG UID=1010 - -# Define basic default enviroment variables -ENV DISPLAY=:0 \ - USER=${USER} \ - HOME=/mydrive - -# Create new user and set a set a valid shell for them -RUN mkdir -p $HOME && useradd -ms /bin/bash -u ${UID} $USER - -# Set permissions on user home -RUN chown -R $USER:$USER $HOME - -# Set the user to use -USER $USER - -WORKDIR $HOME - -CMD blender diff --git a/provisioning/containers/blender/Dockerfile b/provisioning/containers/blender/Dockerfile index 27eb2d7e4..4f0d3aaa4 100644 --- a/provisioning/containers/blender/Dockerfile +++ b/provisioning/containers/blender/Dockerfile @@ -1,5 +1,57 @@ -# Start from https://github.com/nytimes/rd-blender-docker -FROM nytimes/blender:2.92-cpu-ubuntu18.04 +# Original Dockerfile from https://github.com/nytimes/rd-blender-docker/blob/master/dist/2.92-cpu-ubuntu18.04/Dockerfile +# Includes edits to update to the latest LTS version + +# ! With 18.04 there are issues with blender > 2.83.8 +FROM ubuntu:20.04 + +# Enviorment variables +ENV DEBIAN_FRONTEND noninteractive +ENV LC_ALL C.UTF-8 +ENV LANG C.UTF-8 + +# Install dependencies +RUN apt-get update && apt-get install -y \ + wget \ + libopenexr-dev \ + bzip2 \ + build-essential \ + zlib1g-dev \ + libxmu-dev \ + libxi-dev \ + libxxf86vm-dev \ + libfontconfig1 \ + libxrender1 \ + libgl1-mesa-glx \ + xz-utils \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/*.* + +ARG BLENDER_VERSION_MAJOR="2.92" +ARG BLENDER_VERSION_MINOR="0" +ENV BLENDER_VER="${BLENDER_VERSION_MAJOR}.${BLENDER_VERSION_MINOR}-linux64" +ENV PATH "$PATH:/bin/${BLENDER_VERSION_MAJOR}/python/bin/" +ENV BLENDER_PATH "/bin/${BLENDER_VERSION_MAJOR}" +ENV BLENDERPIP "/bin/${BLENDER_VERSION_MAJOR}/python/bin/pip3" +ENV BLENDERPY "/bin/${BLENDER_VERSION_MAJOR}/python/bin/python3.7m" + +# Download and install Blender +RUN wget -q https://ftp.nluug.nl/pub/graphics/blender/release/Blender${BLENDER_VERSION_MAJOR}/blender-${BLENDER_VER}.tar.xz \ + && tar -xf blender-${BLENDER_VER}.tar.xz --strip-components=1 -C /bin \ + && rm -rf blender-${BLENDER_VER}.tar.xz \ + && rm -rf blender-${BLENDER_VER} \ + && rm -rf ${BLENDER_PATH}/python/lib/python3.7/site-packages/numpy + +# Download the Python source since it is not bundled with Blender +# Also upgrades the the bulndled outdated version of numpy with a modern one +# Must first ensurepip to install Blender pip3 and then new numpy +RUN wget -q https://www.python.org/ftp/python/3.7.10/Python-3.7.10.tgz \ + && tar -xzf Python-3.7.10.tgz \ + && cp -r Python-3.7.10/Include/* $BLENDER_PATH/python/include/python3.7m/ \ + && rm -rf Python-3.7.10.tgz \ + && rm -rf Python-3.7.10 \ + && ${BLENDERPY} -m ensurepip \ + && ${BLENDERPIP} install --upgrade pip \ + && ${BLENDERPIP} install numpy # Define user and user id default arguments ARG USER=crownlabs