Skip to content

Commit

Permalink
add Dockerfile (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
bearney74 committed Apr 4, 2017
1 parent 43cd9db commit 2a71175
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 15 deletions.
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM python:3

# Install numpy using system package manager
RUN apt-get -y update && apt-get -y install libav-tools imagemagick libopencv-dev python-opencv

# Install some special fonts we use in testing, etc..
RUN apt-get -y install fonts-liberation

RUN apt-get install -y locales && \
locale-gen C.UTF-8 && \
/usr/sbin/update-locale LANG=C.UTF-8

ENV LC_ALL C.UTF-8

# do we need all of these, maybe remove some of them?
RUN pip install imageio numpy scipy matplotlib pandas sympy nose decorator tqdm pillow pytest

# install scikit-image after the other deps, it doesn't cause errors this way.
RUN pip install scikit-image sklearn

ADD . /var/src/moviepy/
#RUN git clone https://github.com/Zulko/moviepy.git /var/src/moviepy
RUN cd /var/src/moviepy/ && python setup.py install

# install ffmpeg from imageio.
RUN python -c "import imageio; imageio.plugins.ffmpeg.download()"

#add soft link so that ffmpeg can executed (like usual) from command line
RUN ln -s /root/.imageio/ffmpeg/ffmpeg.linux64 /usr/bin/ffmpeg

# modify ImageMagick policy file so that Textclips work correctly.
RUN cat /etc/ImageMagick-6/policy.xml | sed 's/none/read,write/g'> /etc/ImageMagick-6/policy.xml
42 changes: 42 additions & 0 deletions docs/docker.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Moviepy Docker
===============

Prequisites
-------------

1. Docker installed `Docker for Mac, Docker for windows, linux, etc <https://www.docker.com/get-docker/>`_
2. Build the Dockerfile ::
docker build -t moviepy -f Dockerfile .


Steps to run the git repo unittests from docker
------------------------------------------------

Get a bash prompt in the moviepy container ::

cd tests
docker run -it -v `pwd`:/tests moviepy bash

Run the tests ::
cd tests
python test_issues.py

Running your own moviepy script from docker
--------------------------------------------

Change directory to where your script is located

If moviepy docker container is already running, you can connect by: ::

docker exec -it moviepy python myscript.py

If the container isn't running already ::

docker run -it moviepy bash
python myscript.py

You can also start a container and run a script in one command: ::

docker run -it -v `pwd`:/code moviepy python myscript.py
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ User Guide
getting_started/getting_started
gallery
examples/examples
docker
FAQ
ref/ref

Expand Down
41 changes: 27 additions & 14 deletions tests/test_PR.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,41 @@

from moviepy.editor import *

import sys
sys.path.append("tests")
import download_media
from test_helper import PYTHON_VERSION, TMP_DIR, TRAVIS

def test_download_media(capsys):
with capsys.disabled():
download_media.download()

def test_PR_306():
if TRAVIS:
return

#put this back in once we get ImageMagick working on travis-ci
#assert TextClip.list('font') != []
#assert TextClip.list('color') != []
assert TextClip.list('font') != []
assert TextClip.list('color') != []

#with pytest.raises(Exception, message="Expecting Exception"):
# TextClip.list('blah')
pass
with pytest.raises(Exception, message="Expecting Exception"):
TextClip.list('blah')


def test_PR_339():
if TRAVIS:
return

#in caption mode
#overlay = TextClip(txt='foo',
# color='white',
# size=(640, 480),
# method='caption',
# align='center',
# fontsize=25)
overlay = TextClip(txt='foo',
color='white', font="Liberation-Mono",
size=(640, 480),
method='caption',
align='center',
fontsize=25)

#in_label_mode
#overlay = TextClip(txt='foo', method='label')
pass
overlay = TextClip(txt='foo', font="Liberation-Mono", method='label')


def test_PR_424():
Expand All @@ -44,7 +56,8 @@ def test_PR_424():

def test_PR_458():
clip = ColorClip([1000, 600], color=(60, 60, 60), duration=10)
clip.write_videofile("test.mp4", progress_bar=False, fps=30)
clip.write_videofile(os.path.join(TMP_DIR, "test.mp4"),
progress_bar=False, fps=30)


def test_PR_515():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_subtitles():
if TRAVIS:
return

generator = lambda txt: TextClip(txt, font='Georgia-Regular',
generator = lambda txt: TextClip(txt, font='Liberation-Mono',
size=(800,600), fontsize=24,
method='caption', align='South',
color='white')
Expand Down

0 comments on commit 2a71175

Please sign in to comment.