Skip to content

Commit

Permalink
Merge pull request #444 from qcfe/vm-to-docker/blender-image
Browse files Browse the repository at this point in the history
  • Loading branch information
kingmakerbot authored Apr 26, 2021
2 parents 6e610fd + 160f423 commit 4c7b0d0
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ jobs:
- websockify
- pycharm
- blender
- blender-lts

include:
# Operators
Expand Down Expand Up @@ -138,6 +139,8 @@ jobs:
context: ./provisioning/containers/pycharm
- component: blender
context: ./provisioning/containers/blender
- component: blender-lts
context: ./provisioning/containers/blender-lts

# SSH bastion
- component: ssh-bastion
Expand Down
75 changes: 75 additions & 0 deletions provisioning/containers/blender-lts/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# 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
4 changes: 2 additions & 2 deletions provisioning/containers/blender/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ ARG UID=1010
# Define basic default enviroment variables
ENV DISPLAY=:0 \
USER=${USER} \
HOME=/home/$USER
HOME=/mydrive

# Create new user and set a set a valid shell for them
RUN useradd -ms /bin/bash -u ${UID} $USER
RUN mkdir -p $HOME && useradd -ms /bin/bash -u ${UID} $USER

# Set permissions on user home
RUN chown -R $USER:$USER $HOME
Expand Down

0 comments on commit 4c7b0d0

Please sign in to comment.