forked from KFERMercer/chaturbate-grabber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
129 lines (103 loc) · 2.82 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#
# This Dockerfile will build a minimal FFmpeg tailored for ctbcap.
# By doing so, it will significantly reduce the size of final image. ( 140MB -> 18MB )
# Requires 1GB of free space on file system to build.
#
# If you don't want to compile FFmpeg:
# `docker build --build-arg BUILD_TARGET=fat --target fat -t ctbcap .`
#
# Default target
ARG BUILD_TARGET=minimal
FROM alpine:latest AS mother
RUN apk add --no-cache curl tini tzdata
RUN <<EOT
mkdir -p /save /log
chmod 777 /save /log
EOT
FROM mother AS fat
ARG BUILD_TARGET
RUN <<EOT
[ ${BUILD_TARGET} = "fat" ] || {
echo "Skipping fat build"
exit 0
}
apk add --no-cache ffmpeg
EOT
USER 1000:1000
ENV TZ="UTC"
ENV LOG_PATH="/log"
ENV SAVE_PATH="/save"
ENV MODEL=""
ENV PLATFORM="chaturbate"
ENV CUT_TIME=3600
ENV EDGING_MODE="uncle makes me pee white"
ENV DEBUG_MODE="your mom is so hot"
HEALTHCHECK \
--interval=300s \
--timeout=30s \
--start-period=300s \
--start-interval=300s \
--retries=3 \
CMD ["ctbcap-healthcheck"]
COPY ./ctbcap-healthcheck /usr/bin/
COPY ./ctbcap /usr/bin/
ENTRYPOINT ["tini", "-g", "--", "ctbcap"]
FROM mother AS builder
RUN <<EOT
apk add --no-cache \
build-base coreutils curl \
openssl-dev nasm zlib-dev
EOT
WORKDIR /tmp/ffmpeg_source
RUN <<EOT
curl "https://ffmpeg.org/releases/"$( \
curl -s -L "https://ffmpeg.org/releases/" \
| grep -oE 'ffmpeg-[0-9]+.*.tar.xz' \
| sed 's|\.tar.xz.*||' \
| sort \
| tail -n 1 \
)".tar.xz" -o ffmpeg.tar.xz
tar -xf ffmpeg.tar.xz --strip-components 1
EOT
WORKDIR /tmp/ffmpeg_bin
RUN <<EOT
/tmp/ffmpeg_source/configure \
--disable-everything \
--disable-autodetect \
--disable-avdevice \
--disable-swscale \
--disable-postproc \
--disable-doc \
--disable-programs --enable-ffmpeg \
--disable-shared --enable-static \
--enable-zlib \
--enable-openssl \
--enable-decoder=h264,hevc,av1,aac \
--enable-parser=h264,hevc,av1,aac \
--enable-demuxer=hls,h264,hevc,av1,mp4,m4v,mpegts \
--enable-muxer=h264,hevc,av1,segment,matroska \
--enable-bsf=extract_extradata \
--enable-protocol=hls,http,https,file
EOT
RUN make -j$(nproc)
FROM mother AS minimal
COPY --from=builder /tmp/ffmpeg_bin/ffmpeg /usr/bin/
USER 1000:1000
ENV TZ="UTC"
ENV LOG_PATH="/log"
ENV SAVE_PATH="/save"
ENV MODEL=""
ENV PLATFORM="chaturbate"
ENV CUT_TIME=3600
ENV EDGING_MODE="uncle makes me pee white"
ENV DEBUG_MODE="your mom is so hot"
HEALTHCHECK \
--interval=300s \
--timeout=30s \
--start-period=300s \
--start-interval=300s \
--retries=3 \
CMD ["ctbcap-healthcheck"]
COPY ./ctbcap-healthcheck /usr/bin/
COPY ./ctbcap /usr/bin/
ENTRYPOINT ["tini", "-g", "--", "ctbcap"]