-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add Dockerfile #522
add Dockerfile #522
Conversation
I assume this is intended to replace #65? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far, left a few comments.
Dockerfile
Outdated
|
||
# install from github since there are bugs in latest versions. | ||
RUN git clone https://github.com/Zulko/moviepy.git /var/src/moviepy | ||
RUN cd /var/src/moviepy/ && python setup.py install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the Dockerfile is going to be included with the source, we won't need to pull down from git, we can just include it like this.
ADD . /var/src/moviepy/
RUN cd /var/src/moviepy/ && python setup.py install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this comment might get lost. Commenting again in the thread, incase it does.
Dockerfile
Outdated
# install scikit-image after the other deps, it doesn't cause errors this way. | ||
RUN pip install scikit-image sklearn | ||
|
||
# install from github since there are bugs in latest versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this comment now.
Dockerfile
Outdated
RUN cd /var/src/moviepy/ && python setup.py install | ||
|
||
# install ffmpeg from imageio. | ||
RUN python -c "import imageio; imageio.plugins.ffmpeg.download()" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will install ffmpeg into a weird location not in the path, should we add a symlink or something to put in in a location that is more common?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.. I'll work on adding that.. Thanks for pointing this out.
Dockerfile
Outdated
RUN pip install scikit-image sklearn | ||
|
||
RUN git clone https://github.com/Zulko/moviepy.git /var/src/moviepy | ||
RUN cd /var/src/moviepy/ && python setup.py install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-commenting since it is no longer showing up.
Since the Dockerfile is going to be included with the source, we won't need to pull down from git, we can just include it like this.
ADD . /var/src/moviepy/
RUN cd /var/src/moviepy/ && python setup.py install
1 similar comment
👍 LGTM, thanks for putting this together. |
We will want to write some documentation on how to use the dockerfile. Are there standard documentation standards that docker uses, that we could adopt so that people fluent in docker can hit the ground running? |
@Earney good idea. Take a look at this gist, and let me know if that seems reasonable. https://gist.github.com/kencochrane/9047c8765fc127449b7760726f113cda It is for a dockerfile for building the moviepy docs, but the directions should be similar. It basically breaks down to these steps
Once this PR is merged, we can add an automated build on docker hub, which will remove the need for people to build the docker image themselves, they will be able to just pull the moviepy image from the hub, and get started. |
4 similar comments
4 similar comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thank you!
@kencochrane will docker automatically create a moviepy image since the Dockerfile has been created? When the image is created, how do people find it, and use it? I'd like to add some of these details to the docker rst file I created earlier this week. Thanks! |
@Earney we will need to setup an automated build, which tells Docker Hub where to find the Dockerfile, and sets up a github webhook to let hub know when there are changes to the git repo, so it can rebuild. I have claimed the I recommend that we setup the automated build like this.
Once we have the automated builds setup, we can add some directions to the |
My docker id is earney |
@Earney thanks, just invited you to the org. If you need help with anything, let me know. |
Thanks.. I'll take a look. |
@kencochrane when I try to configure the autobuilds, zulko is not in the list of github organization I can choose from (but earney is). |
@Earney I think Zulko is a personal account on github, and not an organization, so you are probably just a collaborator on that repo, and github doesn't give you access to administrator that repo, like it would if it was an organization. zulko, will probably be the one that needs to setup the automated build since it is tied to his github account, and not an organization. I also noticed that you made a repo called |
@kencochrane I was afraid of that.. I couldn't make moviepy/moviepy:latest (it complained about the :).. I'll remove that repo, and will create one called moviepy/moviepy. |
@Earney ok, sounds good. thank you |
We might benefit from consolidating the image layers to something like:
Ideally, we'd want to make this image smaller (while decreasing the number of layers we introduce) for easier distribution and usage. We'd probably see the largest decrease in image size from rolling our own image directly versus using the python image. During my testing of size, I ended up splitting up the requirements into base/test/doc.txt files inheriting from base.txt. We can probably reevaluate the apt packages being installed as well. Additionally, we might want to consider switching off of the liberation font 👍 for an official org on docker hub. Thanks for working on this @kencochrane @Earney ! |
@mbeacom I agree we should limit the number of layers, but unfortunately your approach above, would cause other problems. This would cause one RUN command and one layer, but if anything changes in that RUN it will break the build cache, specifically the Using your approach, we can probably do something in the middle, instead of merging to just one RUN command, break it down into a few.
There is a new feature in recent versions of docker that let you squash your layers after build, and keep your cache, so the end result is the same, but you get caching, which removes the need to build each layer every time. https://docs.docker.com/engine/reference/commandline/build/#squash-an-images-layers---squash-experimental-only If we want smaller packaging we can look at using an alpine based image (python:3-alpine), but switching to alpine brings in other challenges, like finding the right system libraries etc. Switching to What ever we do, we should probably stay on top of an official image, this way we will automatically get security and bug fixes from upstream and one less thing to have to manage outside of the scope of this project. |
@kencochrane Regarding build cache, you're right. Maybe it's bad practice on my end, but when distributing images for general usage, I try to drop additional layers. Normally I use alpine-based images whenever possible. 👍 For alpine! Sadly from the look of it, we'll run into issues with |
@mbeacom yeah, alpine is great, but since it isn't as popular there are some edge cases that normally cause issues. I'm fine with rolling our own image based off an official base image (debian, ubuntu, etc) that isn't a python base image, just as long as we aren't doing everything from scratch :) |
I believe a python:3-slim is a good compromise. I can test this out and see if it works on the test cases, if so we might want to start out with it, and adjust when necessary. |
for people that use docker, they will easily be able to install moviepy.