Merge branch 'master' of github.com:3b1b/manim into ode

This commit is contained in:
Grant Sanderson 2019-04-02 13:56:27 -07:00
commit 065605f6c6
3 changed files with 36 additions and 33 deletions

View file

@ -1,24 +1,14 @@
FROM ubuntu:18.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -qqy
RUN apt-get install -qqy --no-install-recommends apt-utils
WORKDIR /root
RUN apt-get install --no-install-recommends -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 wget ffmpeg apt-transport-https texlive-latex-base \
texlive-full texlive-fonts-extra sox git libcairo2-dev libjpeg-dev libgif-dev && rm -rf /var/lib/apt/lists/*
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
FROM python:3.7
RUN apt-get update \
&& apt-get install -qqy --no-install-recommends \
apt-utils \
ffmpeg \
texlive-latex-base \
texlive-full \
texlive-fonts-extra \
sox \
libcairo2-dev \
&& rm -rf /var/lib/apt/lists/*
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*
ENV TZ=America/Los_Angeles
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
ENV DEBIAN_FRONTEND teletype
RUN python -m pip install -r requirements.txt && rm requirements.txt
ENTRYPOINT ["/bin/bash"]

View file

@ -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 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

18
docker-compose.yml Normal file
View file

@ -0,0 +1,18 @@
version: '3.1'
services:
manim:
# 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:
- PYTHONPATH=/opt/manim
working_dir: /opt/manim
entrypoint:
- python
- -m
- manim
network_mode: "none"