Xonshiz / anime-dl

Anime-dl is a command-line program to download anime from CrunchyRoll and Funimation.
MIT License
229 stars 37 forks source link

Proposal to add a Dockerfile #102

Open gnoejuan opened 5 years ago

gnoejuan commented 5 years ago

The Dockerfile could allow both for a quick deployment of anime-dl and aide the installation of a bare-metal/desktop instance. After encountering a possible occurrence of Issue 28, ImportError: No module named anime_dl, a Dockerfile would also help eliminate issues occurring from differences in python/node/OS.

Although, the easiest help would probably be to add Python [x.x.x] and Node [x.x.x] versions to the README.MD

The first part of a possible Dockerfile would be the following:

Assumptions: Python 3.7.x and Node.js 12.x.x

# dockerfile A
# python 3.7.x debian 9
FROM bitnami/python:3.7-debian-9-prod as python
# node.js 12.x.x debian 9
FROM bitnami/node:12-debian-9-prod as node
# The final docker image will only include bitnami/node + the instructions below.
# copy the python install into the nodejs install.
# WORKDIR /app is inherited from bitnami/node
COPY --from=python /opt/bitnami/python /opt/bitnami/python
ENV PATH="/opt/bitnami/python/bin:$PATH"
# install_packages is equivalent to debian apt-get
RUN install_packages mkvtoolnix rtmpdump ffmpeg
# b1 OR b2 would follow

After this, I would be making assumptions. I believe the better, docker way would be the following:

# dockerfile b1
RUN  pip install -r https://raw.githubusercontent.com/Xonshiz/anime-dl/master/requirements.txt
# Assuming the Dockerfile is placed at the root of the repository
COPY anime_dl .
RUN     chmod +x Anime_dl.py && \
    chmod +x __main__.p
ENTRYPOINT ["python", "__main__.py"]

But then the Dockerfile wouldn't be a good reference for people without Docker. Assuming you want to provide a dockerfile that performs as both a dockerfile and a reference for others, the dockerfile might instead continue like so:

#dockerfile b2
RUN git clone https://github.com/Xonshiz/anime-dl.git &&\
    cd anime-dl && \
    pip install -r requirments.txt && \
   chmod +x anime_dl/Anime_dl.py && \
    chmod +x anime_dl/__main__.py
# Each docker command resets to the WORKDIR
ENTRYPOINT ["python", "anime-dl/anime_dl/__main__.py"]

Looking through this file it looks like the output goes into anime-dl/anime_dl/Output.

So a usage example should be docker run -v /home/($USER)/Videos:/app/anime-dl/anime_dl/Output anime-dl -i "http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059" -u "YourUsername" -p "Password" -r "Resolution"

Using alias animedl=docker run -v /home/($USER)/Videos:/app/anime-dl/anime_dl/Output anime-dl should cut that down to

animedl -i "http://www.crunchyroll.com/i-cant-understand-what-my-husband-is-saying/episode-13-happy-days-678059" -u "YourUsername" -p "Password" -r "Resolution"

Anichiraku-Main commented 4 years ago

Suprised this havent had a PR yet