-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.alpine_qeek_ffmpeg
267 lines (258 loc) · 13.5 KB
/
Dockerfile.alpine_qeek_ffmpeg
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
FROM alpine:3.7
MAINTAINER "Ming-Jui Chen" <[email protected]>
WORKDIR /tmp
ENV FFMPEG_VERSION=3.3.2 \
FDKAAC_VERSION=0.1.5 \
LAME_VERSION=3.99.5 \
OGG_VERSION=1.3.2 \
OPENCOREAMR_VERSION=0.1.4 \
OPUS_VERSION=1.2 \
TEORA_VERSION=1.1.1 \
VORBIS_VERSION=1.3.5 \
VPX_VERSION=1.6.1 \
X264_VERSION=20170226-2245-stable \
X265_VERSION=2.3 \
XVID_VERSION=1.3.4 \
FREETYPE_VERSION=2.5.5 \
LIBVIDSTAB_VERSION=1.1.0 \
THEORA_VERSION=1.1.1 \
LIBVA_VERSION=f1a3296d160dbedd695f2712c97fb0dc508785f2 \
INTEL_VAAPI_DRIVER_VERSION=127183b7f528ead9d0f2054277e6da162c6522f2 \
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
SRC=/usr/local \
NGINX_VERSION=1.13.8 \
NGINX_RTMP_MODULE_VERSION=1.2.2-qeek
ARG OGG_SHA256SUM="e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692 libogg-1.3.2.tar.gz"
ARG OPUS_SHA256SUM="77db45a87b51578fbc49555ef1b10926179861d854eb2613207dc79d9ec0a9a9 opus-1.2.tar.gz"
ARG VORBIS_SHA256SUM="6efbcecdd3e5dfbf090341b485da9d176eb250d893e3eb378c428a2db38301ce libvorbis-1.3.5.tar.gz"
ARG THEORA_SHA256SUM="40952956c47811928d1e7922cda3bc1f427eb75680c3c37249c91e949054916b libtheora-1.1.1.tar.gz"
ARG XVID_SHA256SUM="4e9fd62728885855bc5007fe1be58df42e5e274497591fec37249e1052ae316f xvidcore-1.3.4.tar.gz"
ARG FREETYPE_SHA256SUM="5d03dd76c2171a7601e9ce10551d52d4471cf92cd205948e60289251daddffa8 freetype-2.5.5.tar.gz"
ARG LIBVIDSTAB_SHA256SUM="14d2a053e56edad4f397be0cb3ef8eb1ec3150404ce99a426c4eb641861dc0bb v1.1.0.tar.gz"
ARG FFMPEG_KEY="D67658D8"
RUN buildDeps="make \
gcc \
libc-dev \
openssl-dev \
pcre-dev \
zlib-dev \
linux-headers \
curl \
gnupg \
wget \
libxslt-dev \
gd-dev \
geoip-dev \
autoconf \
automake \
bash \
binutils \
bzip2 \
cmake \
coreutils \
g++ \
libtool \
python \
tar \
yasm \
libdrm-dev \
libgcc \
libstdc++ \
ca-certificates \
libgomp \
libdrm \
openssl \
iputils \
ca-certificates \
git " \
&& export MAKEFLAGS="-j$(($(grep -c ^processor /proc/cpuinfo) + 1))" \
&& apk update \
&& apk add --virtual .build-deps ${buildDeps} \
&& addgroup -S nginx \
&& adduser -D -S -h /var/cache/nginx -s /sbin/ash -G nginx nginx \
&& echo "[Build] opencore-amr" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sL https://downloads.sf.net/project/opencore-amr/opencore-amr/opencore-amr-${OPENCOREAMR_VERSION}.tar.gz | tar -zx --strip-components=1 \
&& ./configure --prefix="${SRC}" --bindir="${SRC}/bin" --enable-shared --datadir=${DIR} \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] x264" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLk https://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2 | tar -jx --strip-components=1 \
&& ./configure --prefix="${SRC}" --bindir="${SRC}/bin" --enable-pic --enable-shared --disable-cli \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] x265" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLk https://download.videolan.org/pub/videolan/x265/x265_${X265_VERSION}.tar.gz | tar -zx \
&& cd x265_${X265_VERSION}/build/linux \
&& ./multilib.sh \
&& make -C 8bit install \
&& rm -rf ${DIR} \
&& echo "[Build] ogg" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO http://downloads.xiph.org/releases/ogg/libogg-${OGG_VERSION}.tar.gz \
&& echo ${OGG_SHA256SUM} | sha256sum --check \
&& tar -zx --strip-components=1 -f libogg-${OGG_VERSION}.tar.gz \
&& ./configure --prefix="${SRC}" --bindir="${SRC}/bin" --disable-static --datarootdir=${DIR} \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] libopus" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz \
&& echo ${OPUS_SHA256SUM} | sha256sum --check \
&& tar -zx --strip-components=1 -f opus-${OPUS_VERSION}.tar.gz \
&& autoreconf -fiv \
&& ./configure --prefix="${SRC}" --disable-static --datadir="${DIR}" \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] Bbvuild liorbis" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO http://downloads.xiph.org/releases/vorbis/libvorbis-${VORBIS_VERSION}.tar.gz \
&& echo ${VORBIS_SHA256SUM} | sha256sum --check \
&& tar -zx --strip-components=1 -f libvorbis-${VORBIS_VERSION}.tar.gz \
&& ./configure --prefix="${SRC}" --with-ogg="${SRC}" --bindir="${SRC}/bin" --disable-static --datadir="${DIR}" \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] libtheora" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO http://downloads.xiph.org/releases/theora/libtheora-${THEORA_VERSION}.tar.gz \
&& echo ${THEORA_SHA256SUM} | sha256sum --check \
&& tar -zx --strip-components=1 -f libtheora-${THEORA_VERSION}.tar.gz \
&& ./configure --prefix="${SRC}" --with-ogg="${SRC}" --bindir="${SRC}/bin" --disable-static --datadir="${DIR}" \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] libvpx" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sL https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | tar -zx --strip-components=1 \
&& ./configure --prefix="${SRC}" --enable-vp8 --enable-vp9 --enable-pic --disable-debug --disable-examples --disable-docs --disable-install-bins --enable-shared \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] libmp3lame" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sL https://downloads.sf.net/project/lame/lame/${LAME_VERSION%.*}/lame-${LAME_VERSION}.tar.gz | tar -zx --strip-components=1 \
&& ./configure --prefix="${SRC}" --bindir="${SRC}/bin" --disable-static --enable-nasm --datarootdir="${DIR}" \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] xvid" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO http://downloads.xvid.org/downloads/xvidcore-${XVID_VERSION}.tar.gz \
&& echo ${XVID_SHA256SUM} | sha256sum --check \
&& tar -zx -f xvidcore-${XVID_VERSION}.tar.gz \
&& cd xvidcore/build/generic \
&& ./configure --prefix="${SRC}" --bindir="${SRC}/bin" --datadir="${DIR}" --disable-static --enable-shared \
&& make && make install && rm -rf ${DIR} \
&& echo "[Build] fdk-aac" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sL https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | tar -zx --strip-components=1 \
&& autoreconf -fiv && ./configure --prefix="${SRC}" --disable-static --datadir="${DIR}" \
&& make && make install && make distclean && rm -rf ${DIR} \
&& echo "[Build] freetype" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz \
&& echo ${FREETYPE_SHA256SUM} | sha256sum --check \
&& tar -zx --strip-components=1 -f freetype-${FREETYPE_VERSION}.tar.gz \
&& ./configure --disable-static --enable-shared \
&& make && make install && make distclean && rm -rf ${DIR} \
&& echo "[Build] libvidstab" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO https://github.com/georgmartius/vid.stab/archive/v${LIBVIDSTAB_VERSION}.tar.gz \
&& echo ${LIBVIDSTAB_SHA256SUM} | sha256sum --check \
&& tar -zx --strip-components=1 -f v${LIBVIDSTAB_VERSION}.tar.gz \
&& cmake . && make && make install && rm -rf ${DIR} \
&& echo "[Build] libva" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sL https://codeload.github.com/01org/libva/tar.gz/${LIBVA_VERSION} | tar -zx --strip-components=1 \
&& ./autogen.sh && ./configure --prefix="${SRC}" --bindir="${SRC}/bin" --datadir="${DIR}" \
&& make -j${NPROC} && make install && make distclean && rm -rf ${DIR} \
&& echo "[Build] intel-vaapi-driver" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sL https://codeload.github.com/01org/intel-vaapi-driver/tar.gz/${INTEL_VAAPI_DRIVER_VERSION} | tar -zx --strip-components=1 \
&& ./autogen.sh && ./configure --prefix="${SRC}" --bindir="${SRC}/bin" --datadir="${DIR}" \
&& make -j${NPROC} && make install && make distclean && rm -rf ${DIR} \
&& echo "[Build] ffmpeg" && DIR=$(mktemp -d) && cd ${DIR} \
&& curl -sLO https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz \
&& tar -zx --strip-components=1 -f ffmpeg-${FFMPEG_VERSION}.tar.gz \
&& ./configure \
--bindir="${SRC}/bin" \
--disable-debug \
--disable-doc \
--disable-ffplay \
--disable-static \
--enable-vaapi \
--enable-avresample \
--enable-gpl \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libfdk_aac \
--enable-libfreetype \
--enable-libvidstab \
--enable-libmp3lame \
--enable-libopus \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-nonfree \
--enable-openssl \
--enable-postproc \
--enable-shared \
--enable-small \
--enable-version3 \
--disable-decoder=ac3 \
--disable-decoder=ac3_fixed \
--disable-decoder=eac3 \
--disable-decoder=dca \
--disable-decoder=truehd \
--disable-encoder=ac3 \
--disable-encoder=ac3_fixed \
--disable-encoder=eac3 \
--disable-encoder=dca \
--extra-cflags="-I${SRC}/include" \
--extra-ldflags="-L${SRC}/lib" \
--extra-libs=-ldl \
--prefix="${SRC}" \
&& make && make install && make distclean && hash -r \
&& cd tools && make qt-faststart && cp qt-faststart ${SRC}/bin \
&& rm -rf ${DIR}
RUN echo "[Build] Nginx & RTMP module" && DIR=$(mktemp -d) && cd ${DIR} \
&& wget -O nginx-${NGINX_VERSION}.tar.gz https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \
&& tar -zxf nginx-${NGINX_VERSION}.tar.gz \
&& wget -O nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz https://github.com/cutedogspark/nginx-rtmp-module/archive/v${NGINX_RTMP_MODULE_VERSION}.tar.gz \
&& tar -zxf nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz \
&& cd nginx-${NGINX_VERSION} \
&& ./configure \
--user=nginx \
--group=nginx \
--add-module=../nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION} \
--with-http_ssl_module \
--with-http_xslt_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-http_dav_module \
--with-http_auth_request_module \
--with-mail \
--with-mail_ssl_module \
--with-file-aio \
--with-threads \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module \
--with-http_slice_module \
--with-http_v2_module \
&& make ${MAKEFLAGS} && make install \
&& echo "Cleanup" \
&& apk add --no-cache --virtual .gettext gettext \
&& mv /usr/bin/envsubst /tmp/ \
&& runDeps="$( \
scanelf --needed --nobanner \
/usr/local/nginx/sbin/nginx \
/usr/local/nginx/modules/*.so \
/usr/local/bin/ffmpeg \
/tmp/envsubst \
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
| sort -u \
| xargs -r apk info --installed \
| sort -u \
) supervisor bash libgomp libgcc libstdc++ libdrm openssl iputils ca-certificates" \
&& apk add --no-cache --virtual .nginx-rundeps $runDeps \
&& apk del .build-deps \
&& apk del .gettext \
&& mv /tmp/envsubst /usr/local/bin/ \
&& rm -rf /var/cache/apk/* /tmp/* \
&& ffmpeg -buildconf \
&& ln -sf /usr/local/bin/ffmpeg /usr/bin/qtranscoder \
&& ln -sf /usr/local/bin/ffmpeg /usr/bin/dj2-transcode
COPY config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY config/nginx.conf /usr/local/nginx/conf/nginx.conf
COPY static/crossdomain.xml /usr/local/nginx/html/
COPY static/stat_qeek.xsl /usr/local/nginx/html/stat.xsl
EXPOSE 1935 80 443
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]