From 8d66cfb75b2781e74f1de29d8e331f349aef03a8 Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Sun, 14 Oct 2018 20:44:23 +0200 Subject: [PATCH 01/14] Removes superfluous packages. The apt package texlive-full already includes texlive-latex-base and texlive-fonts-extra, so they don't have to installed separately. --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index ef72df0f..7a8a8a28 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,9 +27,7 @@ RUN apt-get install -qqy ffmpeg ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get install -qqy apt-transport-https -RUN apt-get install -qqy texlive-latex-base RUN apt-get install -qqy texlive-full -RUN apt-get install -qqy texlive-fonts-extra RUN apt-get install -qqy sox RUN apt-get install -qqy git From 4ba9f6b5a31188c53cf51da618de351863a43348 Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Sun, 14 Oct 2018 23:32:46 +0200 Subject: [PATCH 02/14] Consolidates apt package installations. Turns all package installations into one single command. --- Dockerfile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7a8a8a28..105f2146 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,33 @@ FROM ubuntu:18.04 ENV DEBIAN_FRONTEND noninteractive +# Install required packages. RUN apt-get update -qqy RUN apt-get install -qqy --no-install-recommends apt-utils - -WORKDIR /root RUN apt-get install -qqy build-essential libsqlite3-dev sqlite3 bzip2 \ libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev \ libgdbm-compat-dev liblzma-dev libreadline-dev \ - libncursesw5-dev libffi-dev uuid-dev + libncursesw5-dev libffi-dev uuid-dev \ + libcairo2-dev libjpeg-dev libgif-dev ffmpeg \ + apt-transport-https texlive-full sox git + +# Install Python 3.7. +WORKDIR /root RUN apt-get install -qqy wget RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz RUN tar -xf Python-3.7.0.tgz WORKDIR Python-3.7.0 RUN ./configure > /dev/null && make -s && make -s install RUN python3 -m pip install --upgrade pip -RUN apt-get install -qqy libcairo2-dev libjpeg-dev libgif-dev COPY requirements.txt requirements.txt RUN python3 -m pip install -r requirements.txt RUN rm requirements.txt WORKDIR /root RUN rm -rf Python-3.7.0* -RUN apt-get install -qqy ffmpeg - +# Setup timezone. ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone -RUN apt-get install -qqy apt-transport-https -RUN apt-get install -qqy texlive-full -RUN apt-get install -qqy sox -RUN apt-get install -qqy git ENV DEBIAN_FRONTEND teletype ENTRYPOINT ["/bin/bash"] From 9077860f97eeb6c3a66674a71bcb8c156ff9d5df Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Sun, 14 Oct 2018 23:34:06 +0200 Subject: [PATCH 03/14] Removes superfluous delete command. As suggested by @eulertour, this removes the line to delete `requirements.txt` in the python folder, as the whole folder would be deleted later anyways. --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 105f2146..e96eab26 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,6 @@ RUN ./configure > /dev/null && make -s && make -s install RUN python3 -m pip install --upgrade pip COPY requirements.txt requirements.txt RUN python3 -m pip install -r requirements.txt -RUN rm requirements.txt WORKDIR /root RUN rm -rf Python-3.7.0* From 9b76c29fc7bebe83e2e6d93c088f543047bca37e Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Mon, 15 Oct 2018 00:48:08 +0200 Subject: [PATCH 04/14] Revert "Consolidates apt package installations." This reverts commit 4ba9f6b5a31188c53cf51da618de351863a43348. --- Dockerfile | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index e96eab26..4773610f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,34 @@ FROM ubuntu:18.04 ENV DEBIAN_FRONTEND noninteractive -# Install required packages. RUN apt-get update -qqy RUN apt-get install -qqy --no-install-recommends apt-utils + +WORKDIR /root RUN apt-get install -qqy build-essential libsqlite3-dev sqlite3 bzip2 \ libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev \ libgdbm-compat-dev liblzma-dev libreadline-dev \ - libncursesw5-dev libffi-dev uuid-dev \ - libcairo2-dev libjpeg-dev libgif-dev ffmpeg \ - apt-transport-https texlive-full sox git - -# Install Python 3.7. -WORKDIR /root + libncursesw5-dev libffi-dev uuid-dev RUN apt-get install -qqy wget RUN wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz RUN tar -xf Python-3.7.0.tgz WORKDIR Python-3.7.0 RUN ./configure > /dev/null && make -s && make -s install RUN python3 -m pip install --upgrade pip +RUN apt-get install -qqy libcairo2-dev libjpeg-dev libgif-dev COPY requirements.txt requirements.txt RUN python3 -m pip install -r requirements.txt WORKDIR /root RUN rm -rf Python-3.7.0* -# Setup timezone. +RUN apt-get install -qqy ffmpeg + ENV TZ=America/Los_Angeles RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get install -qqy apt-transport-https +RUN apt-get install -qqy texlive-full +RUN apt-get install -qqy sox +RUN apt-get install -qqy git ENV DEBIAN_FRONTEND teletype ENTRYPOINT ["/bin/bash"] From 08926ad2aa7c651174a135e148199d6a215a9f40 Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Mon, 15 Oct 2018 00:50:47 +0200 Subject: [PATCH 05/14] Rearranges Dockerfile. Does timezone setup at the beginning. Separates python installation and requirements installation. --- Dockerfile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4773610f..1b5b30bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,11 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -qqy RUN apt-get install -qqy --no-install-recommends apt-utils +# Setup timezone. +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +# Install Python 3.7. WORKDIR /root RUN apt-get install -qqy build-essential libsqlite3-dev sqlite3 bzip2 \ libbz2-dev zlib1g-dev libssl-dev openssl libgdbm-dev \ @@ -15,16 +20,15 @@ RUN tar -xf Python-3.7.0.tgz WORKDIR Python-3.7.0 RUN ./configure > /dev/null && make -s && make -s install RUN python3 -m pip install --upgrade pip -RUN apt-get install -qqy libcairo2-dev libjpeg-dev libgif-dev -COPY requirements.txt requirements.txt -RUN python3 -m pip install -r requirements.txt WORKDIR /root RUN rm -rf Python-3.7.0* -RUN apt-get install -qqy ffmpeg +# Install requirements. +RUN apt-get install -qqy libcairo2-dev libjpeg-dev libgif-dev +COPY requirements.txt requirements.txt +RUN python3 -m pip install -r requirements.txt -ENV TZ=America/Los_Angeles -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get install -qqy ffmpeg RUN apt-get install -qqy apt-transport-https RUN apt-get install -qqy texlive-full RUN apt-get install -qqy sox From da81ed40155f162f5ea16ad1e4bcbf2eb59d805e Mon Sep 17 00:00:00 2001 From: Patrick Elsen Date: Mon, 15 Oct 2018 02:52:40 +0200 Subject: [PATCH 06/14] Fixes Dockerfile to delete requirements.txt. Moved timezone initialization to texlife and made sure to delete requirements.txt in Dockerfile. --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b5b30bc..26ea1b0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,6 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update -qqy RUN apt-get install -qqy --no-install-recommends apt-utils -# Setup timezone. -ENV TZ=America/Los_Angeles -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - # Install Python 3.7. WORKDIR /root RUN apt-get install -qqy build-essential libsqlite3-dev sqlite3 bzip2 \ @@ -27,8 +23,13 @@ RUN rm -rf Python-3.7.0* RUN apt-get install -qqy libcairo2-dev libjpeg-dev libgif-dev COPY requirements.txt requirements.txt RUN python3 -m pip install -r requirements.txt - +RUN rm requirements.txt RUN apt-get install -qqy ffmpeg + +# Setup timezone, necessary for textlive. +ENV TZ=America/Los_Angeles +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + RUN apt-get install -qqy apt-transport-https RUN apt-get install -qqy texlive-full RUN apt-get install -qqy sox From 01e42fb3259066c9558f564e50bafd9e03098e5e Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 00:49:59 +0000 Subject: [PATCH 07/14] remove network restriction --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index a61ed219..f4ef6015 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,4 +8,3 @@ services: - ${MANIM_PATH:?MANIM_PATH environment variable isn't set}:/opt/manim environment: - PYTHONPATH=/opt/manim - network_mode: "none" From f348df5dbc6b2c51a5f46cf32ee9356a073d4fac Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 00:55:05 +0000 Subject: [PATCH 08/14] move workdir from dockerfile to docker-compose.yml --- Dockerfile | 1 - docker-compose.yml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2a8c343d..d3af2279 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,5 +11,4 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt requirements.txt RUN python3 -m pip install -r requirements.txt && rm requirements.txt -WORKDIR /opt/manim ENTRYPOINT ["python", "-m", "manim"] diff --git a/docker-compose.yml b/docker-compose.yml index f4ef6015..941b4edc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,3 +8,4 @@ services: - ${MANIM_PATH:?MANIM_PATH environment variable isn't set}:/opt/manim environment: - PYTHONPATH=/opt/manim + working_dir: /opt/manim From c114e461d5b154674964e215ad28219fa107d75a Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 01:04:10 +0000 Subject: [PATCH 09/14] python3 -> python --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d3af2279..3bfcdae2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,5 +10,5 @@ RUN apt-get update \ libcairo2-dev \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt requirements.txt -RUN python3 -m pip install -r requirements.txt && rm requirements.txt +RUN python -m pip install -r requirements.txt && rm requirements.txt ENTRYPOINT ["python", "-m", "manim"] From 0d1a93cf66f6e9e683b024291ca69f02a28ad650 Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 02:56:09 +0000 Subject: [PATCH 10/14] change dockerfile entrypoint to /bin/bash --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3bfcdae2..98dfc40e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,4 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt requirements.txt RUN python -m pip install -r requirements.txt && rm requirements.txt -ENTRYPOINT ["python", "-m", "manim"] +ENTRYPOINT ["/bin/bash"] From e6210af9d5824b646b2ea66d22b04327512eb385 Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 03:00:22 +0000 Subject: [PATCH 11/14] add entrypoint to docker-compose.yml --- docker-compose.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 941b4edc..2b65b526 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,3 +9,7 @@ services: environment: - PYTHONPATH=/opt/manim working_dir: /opt/manim + entrypoint: + - python + - -m + - manim From a91c0d3bc46380027ded0b4ef026282571ed0480 Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 07:22:46 +0000 Subject: [PATCH 12/14] add info to docker-compose file --- docker-compose.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2b65b526..a39615ad 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,8 +2,10 @@ version: '3.1' services: manim: - image: manim - build: . + # comment this line if you build the image to prevent overwriting the tag + image: eulertour/manim:latest + # uncomment this line to build rather than pull the image + # build: . volumes: - ${MANIM_PATH:?MANIM_PATH environment variable isn't set}:/opt/manim environment: @@ -13,3 +15,4 @@ services: - python - -m - manim + network_mode: "none" From 4ead3627fdeef9b47e0e3621bcd4da823ec43f6b Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 00:57:23 -0700 Subject: [PATCH 13/14] Update README.md --- README.md | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 8b871418..7a90d88c 100644 --- a/README.md +++ b/README.md @@ -27,22 +27,17 @@ python3 -m manim example_scenes.py SquareToCircle -pl ``` ### Using Docker -Since it's a bit tricky to get all the dependencies set up just right, there is a Dockerfile provided in this repo as well as [a premade image on Docker Hub](https://hub.docker.com/r/eulertour/manim/tags/). +Since it's a bit tricky to get all the dependencies set up just right, there is a Dockerfile and Compose file provided in this repo as well as [a premade image on Docker Hub](https://hub.docker.com/r/eulertour/manim/tags/). The Dockerfile contains instructions on how to build a manim image, while the Compose file contains instructions on how to run the image. -The image does not contain a copy of the repo. This is intentional, as it allows you to either bind mount a repo that you've cloned locally or clone any fork/branch you want. Since test coverage is painfully lacking, the image may not have dependencies for all of manim. +The image does not contain a copy of the repo. This is intentional, as it allows you to either bind mount a repo that you've cloned locally or clone any fork/branch you want. In order to do this with the Compose file, you must set the `MANIM_PATH` environment variable to the absolute path to the manim repo. 1. [Install Docker](https://www.docker.com/products/overview) -2. Get the docker image - * Pull it (recommended): `docker pull eulertour/manim:latest`, or - * Build it: `docker build -t manim .` -3. Start the image - * Bind mount a local repo (recommended): `docker run -itv /absolute/path/to/your/local/manim/repo:/root/manim eulertour/manim` or - * Clone a remote repo: `docker run -it eulertour/manim`, then `git clone https://github.com/3b1b/manim.git` -4. Render an animation +2. [Install Docker Compose](https://docs.docker.com/compose/install/) +3. Render an animation ```sh -cd manim -python3 -m manim example_scenes.py SquareToCircle -l +MANIM_PATH=/absolute/path/to/manim/repo docker-compose run python -m manim example_scenes.py SquareToCircle -l ``` +The first time you execute the above command, Docker will pull the image from Docker Hub and cache it. Any subsequent runs until the image is evicted will use the cached image. Note that the image doesn't have any development tools installed and can't preview animations. Its purpose is building and testing only. ## Using manim From b51d1bf6b12c936853629908be9d9d197356aa5e Mon Sep 17 00:00:00 2001 From: Devin Neal Date: Tue, 2 Apr 2019 00:58:57 -0700 Subject: [PATCH 14/14] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a90d88c..51f639a0 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ The image does not contain a copy of the repo. This is intentional, as it allows 2. [Install Docker Compose](https://docs.docker.com/compose/install/) 3. Render an animation ```sh -MANIM_PATH=/absolute/path/to/manim/repo docker-compose run python -m manim example_scenes.py SquareToCircle -l +MANIM_PATH=/absolute/path/to/manim/repo docker-compose run manim example_scenes.py SquareToCircle -l ``` The first time you execute the above command, Docker will pull the image from Docker Hub and cache it. Any subsequent runs until the image is evicted will use the cached image. Note that the image doesn't have any development tools installed and can't preview animations. Its purpose is building and testing only.