forked from manbearwiz/youtube-dl-server
-
Notifications
You must be signed in to change notification settings - Fork 34
/
Dockerfile
70 lines (50 loc) · 2.01 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#
# youtube-dl Server Dockerfile
#
# https://github.com/nbr23/youtube-dl-server
#
ARG YOUTUBE_DL=yt-dlp
FROM --platform=$BUILDPLATFORM node:22-alpine AS nodebuild
WORKDIR /app
COPY ./front/package*.json /app
RUN npm ci
COPY ./front /app
RUN npm run build
FROM python:alpine AS wheels
RUN apk add --no-cache g++
COPY ./requirements.txt .
RUN pip wheel --no-cache-dir --wheel-dir /out/wheels -r <(cat ./requirements.txt| grep -v youtube-dl | grep -v yt-dlp) \
&& pip wheel --no-cache-dir --wheel-dir /out/wheels-youtube-dl -r <(cat ./requirements.txt| grep youtube-dl) \
&& pip wheel --no-cache-dir --wheel-dir /out/wheels-yt-dlp -r <(cat ./requirements.txt| grep yt-dlp)
FROM python:alpine AS base
ARG ATOMICPARSLEY=0
ARG YDLS_VERSION
ARG YDLS_RELEASE_DATE
ENV YDLS_VERSION=$YDLS_VERSION
ENV YDLS_RELEASE_DATE=$YDLS_RELEASE_DATE
WORKDIR /usr/src/app
RUN apk add --no-cache ffmpeg tzdata mailcap
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 || true; fi
VOLUME "/youtube-dl"
VOLUME "/app_config"
COPY --from=wheels /out/wheels /wheels
RUN pip install --no-cache /wheels/*
COPY ./requirements.txt /usr/src/app/
FROM base AS yt-dlp
COPY --from=wheels /out/wheels-yt-dlp /wheels
RUN pip install --no-cache /wheels/*
RUN pip install --no-cache-dir -r <(cat /usr/src/app/requirements.txt| grep -v youtube-dl)
FROM base AS youtube-dl
COPY --from=wheels /out/wheels-youtube-dl /wheels/
RUN pip install --no-cache /wheels/*
RUN pip install --no-cache-dir -r <(cat /usr/src/app/requirements.txt| grep -v yt-dlp)
FROM ${YOUTUBE_DL}
COPY ./config.yml /usr/src/app/default_config.yml
COPY ./ydl_server /usr/src/app/ydl_server
COPY ./youtube-dl-server.py /usr/src/app/
COPY --from=nodebuild /app/dist /usr/src/app/ydl_server/static
EXPOSE 8080
ENV YOUTUBE_DL=$YOUTUBE_DL
ENV YDL_CONFIG_PATH='/app_config'
CMD [ "python", "-u", "./youtube-dl-server.py" ]
HEALTHCHECK CMD wget 127.0.0.1:8080/api/info --spider -q -Y off