|
| 1 | +# |
| 2 | +# youtube-dl Server Dockerfile |
| 3 | +# |
| 4 | +# https://github.com/nbr23/youtube-dl-server |
| 5 | +# |
| 6 | + |
| 7 | +FROM alpine as ffmpeg |
| 8 | + |
| 9 | +WORKDIR /ffmpeg |
| 10 | + |
| 11 | +RUN apk add wget && \ |
| 12 | + if [ "$(uname -m)" == "x86_64" ]; then \ |
| 13 | + wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz; \ |
| 14 | + elif [ "$(uname -m)" == "aarch64" ]; then \ |
| 15 | + wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-arm64-static.tar.xz; \ |
| 16 | + elif [ "$(uname -m)" == "armv7l" ]; then \ |
| 17 | + wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-armhf-static.tar.xz; \ |
| 18 | + else \ |
| 19 | + wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-$(uname -m)-static.tar.xz; \ |
| 20 | + fi \ |
| 21 | + && tar -xvf ffmpeg-git-*-static.tar.xz && cd ffmpeg-git-*-static && mv ffmpeg ffprobe ../ |
| 22 | + |
| 23 | +FROM python:alpine3.13 |
| 24 | +ARG YOUTUBE_DL=youtube_dl |
| 25 | +ARG ATOMICPARSLEY=0 |
| 26 | +ARG YDL_PYTHONPATH='/youtube-dl/.python' |
| 27 | + |
| 28 | +VOLUME "/youtube-dl" |
| 29 | +VOLUME "/app_config" |
| 30 | + |
| 31 | +COPY --from=nbr23/youtube-dl-wheels /out/wheels /wheels |
| 32 | +RUN pip install --no-cache /wheels/* |
| 33 | + |
| 34 | +RUN mkdir -p /usr/src/app |
| 35 | +COPY --from=ffmpeg /ffmpeg/ffmpeg /usr/local/bin/ffmpeg |
| 36 | +COPY --from=ffmpeg /ffmpeg/ffprobe /usr/local/bin/ffprobe |
| 37 | +RUN apk add --no-cache tzdata mailcap |
| 38 | +RUN if [ $ATOMICPARSLEY == 1 ]; then apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing atomicparsley; ln /usr/bin/atomicparsley /usr/bin/AtomicParsley; fi |
| 39 | +COPY ./requirements.txt /usr/src/app/ |
| 40 | +RUN pip install --upgrade pip && sed -i s/youtube-dl/${YOUTUBE_DL}/ /usr/src/app/requirements.txt && pip install --no-cache-dir -r /usr/src/app/requirements.txt |
| 41 | + |
| 42 | +COPY ./bootstrap.sh /usr/src/app/ |
| 43 | +COPY ./docker_run.sh /usr/src/app/ |
| 44 | +COPY ./config.yml /usr/src/app/default_config.yml |
| 45 | +COPY ./ydl_server /usr/src/app/ydl_server |
| 46 | +COPY ./youtube-dl-server.py /usr/src/app/ |
| 47 | + |
| 48 | +WORKDIR /usr/src/app |
| 49 | + |
| 50 | +RUN apk add --no-cache wget && ./bootstrap.sh && apk del wget |
| 51 | + |
| 52 | + |
| 53 | +EXPOSE 8080 |
| 54 | + |
| 55 | +ENV YOUTUBE_DL=$YOUTUBE_DL |
| 56 | +ENV YDL_CONFIG_PATH='/app_config' |
| 57 | +ENV YDL_PYTHONPATH=$YDL_PYTHONPATH |
| 58 | +CMD [ "./docker_run.sh" ] |
0 commit comments