# TBD: Containers are not VMs
# Build environment for static linked binary is in the works.
FROM ubuntu:bionic

LABEL authors="Steven Polley <himself@stevenpolley.net>"
ENV BLENDER_TAR_XZ_URL https://mirror.clarkson.edu/blender/release/Blender2.82/blender-2.82a-linux64.tar.xz

# Install runtime dependencies
RUN apt-get update && \
	apt-get install -y \
		curl \
		bzip2 \
		libfreetype6 \
		libgl1-mesa-dev \
		libglu1-mesa \
		libxi6 \
		libxrender1 \
		unzip && \
	apt-get -y autoremove && \
	rm -rf /var/lib/apt/lists/*

# Download and install Blender
RUN mkdir /usr/local/blender && \
	curl -SL "$BLENDER_TAR_XZ_URL" -o blender.tar.xz && \
	tar xvfz blender.tar.bz2 -C /usr/local/blender --strip-components=1 && \
	rm blender.tar.bz2 

# Install cyclescaler slave runtime
COPY slave .
EXPOSE 8096:8096
ENTRYPOINT ["/slave"]
