Skip to content

Instantly share code, notes, and snippets.

@jamesonwilliams
Created December 8, 2023 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesonwilliams/df5cbbc512bdf716cfb19f9673a2a8a6 to your computer and use it in GitHub Desktop.
Save jamesonwilliams/df5cbbc512bdf716cfb19f9673a2a8a6 to your computer and use it in GitHub Desktop.
Magenta 2.14.0 Dockerfile

Dockerfile for Google Magenta

Google's Magenta project can be challenging to run on your host due to hardware and Python dependencies.

Chelsea E. Manning's has an earlier project which aimed to dockerize an early version of Magenta. But, both Tensorflow and Magenta have evovled quite a bit since then.

So, here's a Dockerfile for Magenta 2.14.0 on its listed dependency, Tensorflow 2.9.1.

The container is intended to be run in heterogenous environments where GPU accelration - even AVX - may not be available. Magenta is installed via Conda to workaround an AVX support issue.

FROM tensorflow/tensorflow:2.9.1
LABEL description="Magenta 2.14.0 on Tensorflow 2.9.1"
USER root
RUN apt-get update --fix-missing && \
apt-get -y install expect build-essential libasound2-dev libjack-dev git-core ffmpeg vim
ENV MC_REMOTE="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"
ENV MC_LOCAL="/tmp/miniconda-install.sh"
ENV CONDA_PATH="/root/miniconda3"
RUN curl $MC_REMOTE > $MC_LOCAL && bash $MC_LOCAL -b -u -p $CONDA_PATH
ENV PATH="${CONDA_PATH}/bin:${PATH}"
RUN touch /root/.bashrc && \
conda init bash && \
. /root/.bashrc && \
echo "y\n" | conda create -n magenta python=3.7 tensorflow=2.9.1 chardet && \
conda activate magenta && \
pip install jupyter magenta && \
pip install --pre python-rtmidi && \
echo 'conda activate magenta' >> /root/.bashrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment