1- FROM debian:jessie
1+ ARG FFMPEG_IMAGE=datarhei/ffmpeg:3
2+ ARG ALPINE_IMAGE=alpine:latest
23
3- MAINTAINER datarhei <info@datarhei.org>
4- ENV RESTREAMER_EDGE_VERSION=0.1.0-rc.4 \
5- FFMPEG_VERSION=3.1.2 \
6- YASM_VERSION=1.3.0 \
7- LAME_VERSION=3_99_5 \
8- NGINX_VERSION=1.10.2 \
9- NGINX_RTMP_VERSION=master \
10- NGINX_NJS=master \
4+ FROM $FFMPEG_IMAGE as ffmpeg
5+
6+ ENV NGINX_VERSION=1.13.5 \
7+ NGINX_RTMP_VERSION=dev \
118 NGINX_DEVEL_KIT_VERSION=0.3.0 \
129 NGINX_STUB_STATUS_PROM=master \
13- LUA_NGINX_MODULE_VERSION=0.10.7 \
14- LUAJIT_VERSION=2.0.4 \
15- LUAJIT_MAJOR_VERSION=2.0 \
16- LUAJIT_LIB=/usr/local/lib \
17- LUAJIT_INC=/usr/local/include/luajit-2.0 \
18-
19- SRC="/usr/local" \
20- LD_LIBRARY_PATH="${SRC}/lib" \
21- PKG_CONFIG_PATH="${SRC}/lib/pkgconfig" \
22-
23- BUILDDEPS="autoconf automake gcc g++ libtool make nasm unzip zlib1g-dev libssl-dev xz-utils cmake build-essential libpcre3-dev"
24-
25- RUN rm -rf /var/lib/apt/lists/* && \
26- apt-get update && \
27- apt-get install -y --force-yes --fix-missing apt-utils && \
28- apt-get upgrade -y && \
29- apt-get install -y --force-yes --fix-missing curl git libpcre3 tar perl ca-certificates apache2-utils libaio1 libxml2 libxslt-dev ${BUILDDEPS} && \
30-
31- # yasm
32- DIR="$(mktemp -d)" && cd "${DIR}" && \
33- curl -LOks "https://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz" && \
34- tar xzvf "yasm-${YASM_VERSION}.tar.gz" && \
35- cd "yasm-${YASM_VERSION}" && \
36- ./configure \
37- --prefix="${SRC}" \
38- --bindir="${SRC}/bin" && \
39- make -j"$(nproc)" && \
40- make install && \
41- make distclean && \
42- rm -rf "${DIR}" && \
43-
44- # x264
45- DIR="$(mktemp -d)" && cd "${DIR}" && \
46- git clone --depth 1 "git://git.videolan.org/x264" && \
47- cd x264 && \
48- ./configure \
49- --prefix="${SRC}" \
50- --bindir="${SRC}/bin" \
51- --enable-static \
52- --disable-cli && \
53- make -j"$(nproc)" && \
54- make install && \
55- make distclean && \
56- rm -rf "${DIR}" && \
57-
58- # libmp3lame
59- DIR="$(mktemp -d)" && cd "${DIR}" && \
60- curl -LOks "https://github.com/rbrito/lame/archive/RELEASE__${LAME_VERSION}.tar.gz" && \
61- tar xzvf "RELEASE__${LAME_VERSION}.tar.gz" && \
62- cd "lame-RELEASE__${LAME_VERSION}" && \
63- ./configure \
64- --prefix="${SRC}" \
65- --bindir="${SRC}/bin" \
66- --enable-nasm \
67- --disable-shared && \
68- make -j"$(nproc)" && \
69- make install && \
70- make distclean && \
71- rm -rf "${DIR}" && \
72-
73- # ffmpeg
74- DIR="$(mktemp -d)" && cd "${DIR}" && \
75- curl -LOks "https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz" && \
76- tar xzvf "ffmpeg-${FFMPEG_VERSION}.tar.gz" && \
77- cd "ffmpeg-${FFMPEG_VERSION}" && \
78- ./configure \
79- --prefix="${SRC}" \
80- --bindir="${SRC}/bin" \
81- --extra-cflags="-I${SRC}/include" \
82- --extra-ldflags="-L${SRC}/lib" \
83- --extra-libs=-ldl \
84- --enable-nonfree \
85- --enable-gpl \
86- --enable-version3 \
87- --enable-avresample \
88- --enable-libmp3lame \
89- --enable-libx264 \
90- --enable-openssl \
91- --enable-postproc \
92- --enable-small \
93- --disable-debug \
94- --disable-doc \
95- --disable-ffserver && \
96- make -j"$(nproc)" && \
97- make install && \
98- make distclean && \
99- hash -r && \
100- cd tools && \
101- make qt-faststart && \
102- cp qt-faststart "${SRC}/bin" && \
103- rm -rf "${DIR}" && \
104- echo "${SRC}/lib" > "/etc/ld.so.conf.d/libc.conf" && \
105- ffmpeg -buildconf && \
10+ NGINX_NJS=master \
11+ LUA_NGINX_MODULE_VERSION=0.10.10 \
12+ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig \
13+ SRC=/usr/local
14+
15+ RUN export buildDeps="autoconf \
16+ automake \
17+ bash \
18+ binutils \
19+ bzip2 \
20+ cmake \
21+ curl \
22+ coreutils \
23+ g++ \
24+ gcc \
25+ gnupg \
26+ libtool \
27+ make \
28+ python \
29+ openssl-dev \
30+ tar \
31+ xz \
32+ git \
33+ pcre-dev \
34+ zlib-dev" && \
35+ export MAKEFLAGS="-j$(($(grep -c ^processor /proc/cpuinfo) + 1))" && \
36+ apk add --update ${buildDeps} libgcc libstdc++ ca-certificates libssl1.0 libxslt-dev libxml2-dev lua lua-dev luajit luajit-dev && \
10637
107- # LuaJIT
10838 DIR=$(mktemp -d) && cd ${DIR} && \
109- curl -LOks "http://luajit.org/download/LuaJIT-${LUAJIT_VERSION}.zip" && \
110- unzip LuaJIT-${LUAJIT_VERSION} && \
111- cd LuaJIT-${LUAJIT_VERSION} && \
112- make install && \
113- ln -sf luajit-${LUAJIT_VERSION} /usr/local/bin/luajit && \
114- rm -rf ${DIR}
115-
116- # nginx-rtmp
117- RUN DIR=$(mktemp -d) && cd ${DIR} && \
11839 curl -LOks "https://github.com/nginx/nginx/archive/release-${NGINX_VERSION}.tar.gz" && \
11940 tar xzvf "release-${NGINX_VERSION}.tar.gz" && \
12041 curl -LOks "https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/archive/${NGINX_RTMP_VERSION}.tar.gz" && \
12142 tar xzvf "${NGINX_RTMP_VERSION}.tar.gz" && \
122- curl -LOks https://github.com/nginx/njs/archive/${NGINX_NJS}.zip && \
123- unzip ${NGINX_NJS}.zip && \
12443 curl -LOks "https://github.com/simpl/ngx_devel_kit/archive/v${NGINX_DEVEL_KIT_VERSION}.zip" -O && \
12544 unzip v${NGINX_DEVEL_KIT_VERSION}.zip && \
12645 curl -LOks "https://github.com/openresty/lua-nginx-module/archive/v${LUA_NGINX_MODULE_VERSION}.zip" && \
12746 unzip v${LUA_NGINX_MODULE_VERSION}.zip && \
12847 curl -LOks "https://github.com/mhowlett/ngx_stub_status_prometheus/archive/${NGINX_STUB_STATUS_PROM}.zip" && \
12948 unzip ${NGINX_STUB_STATUS_PROM}.zip && \
49+ curl -LOks https://github.com/nginx/njs/archive/${NGINX_NJS}.zip && \
50+ unzip ${NGINX_NJS}.zip && \
13051 cd nginx-release-${NGINX_VERSION} && \
13152 auto/configure \
13253 --with-http_ssl_module \
13354 --with-http_xslt_module \
13455 --with-ld-opt="-Wl,-rpath,/usr/local/lib/lua" \
135- --with-http_ssl_module \
13656 --with-http_realip_module \
13757 --with-http_stub_status_module \
138- --add-dynamic-module="../njs-${NGINX_NJS}/nginx" \
139- --add-dynamic-module="../nginx-rtmp-module-${NGINX_RTMP_VERSION}" \
58+ --add-module="../nginx-rtmp-module-${NGINX_RTMP_VERSION}" \
14059 --add-module="../ngx_devel_kit-${NGINX_DEVEL_KIT_VERSION}" \
141- --add-module="../lua-nginx-module-${LUA_NGINX_MODULE_VERSION}" \
60+ --add-dynamic-module="../njs-${NGINX_NJS}/nginx" \
61+ --add-dynamic-module="../lua-nginx-module-${LUA_NGINX_MODULE_VERSION}" \
14262 --add-dynamic-module="../ngx_stub_status_prometheus-${NGINX_STUB_STATUS_PROM}" && \
143- make -j "$(nproc)" && \
63+ make && \
14464 make install && \
14565 cp ../nginx-rtmp-module-${NGINX_RTMP_VERSION}/stat.xsl /usr/local/nginx/html/info.xsl && \
14666 curl -LOks "https://raw.githubusercontent.com/espizo/simple-nginx-rtmp/master/www/entities.dtd" && \
14767 mv entities.dtd /usr/local/nginx/conf/ && \
14868 curl -LOks "https://raw.githubusercontent.com/espizo/simple-nginx-rtmp/master/www/xml2json.xsl" && \
14969 mv xml2json.xsl /usr/local/nginx/conf/ && \
15070 rm -rf ${DIR} && \
151-
152- # letsencrypt
153- cd /opt && \
154- curl -LOks https://dl.eff.org/certbot-auto && \
155- chmod a+x ./certbot-auto && \
156- ./certbot-auto --os-packages-only --noninteractive && \
71+ cd /usr/local/nginx/ && \
72+ curl -LOks "https://raw.githubusercontent.com/knyar/nginx-lua-prometheus/master/prometheus.lua" && \
15773
158- # clappr-player
15974 DIR=$(mktemp -d) && cd ${DIR} && \
16075 curl -LOks "https://github.com/clappr/clappr/archive/master.tar.gz" && \
16176 tar xzvf "master.tar.gz" && \
@@ -164,18 +79,25 @@ RUN DIR=$(mktemp -d) && cd ${DIR} && \
16479 tar xzvf "master.tar.gz" && \
16580 rm master.tar.gz && \
16681 mv * /usr/local/nginx/html && \
167- rm -rf ${DIR} && \
82+ rm -rf ${DIR}
16883
169- # prometheus exporter
170- cd /usr/local/nginx/ && \
171- curl -LOks "https://raw.githubusercontent.com/knyar/nginx-lua-prometheus/master/prometheus.lua" && \
84+ FROM $ALPINE_IMAGE
85+
86+ MAINTAINER datarhei <info@datarhei.org>
17287
173- apt-get purge -y --auto-remove ${BUILDDEPS} && \
174- apt-get clean -y && \
175- rm -rf /var/lib/apt/lists/* \
176- /tmp/* \
177- /var/tmp/*
88+ ENV RESTREAMER_EDGE_VERSION=0.1.0 \
89+ SRC=/usr/local \
90+ LD_LIBRARY_PATH=/usr/local/lib \
91+ PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
17892
93+ COPY --from=ffmpeg /usr/local/bin/ffmpeg /usr/local/bin/ffmpeg
94+ COPY --from=ffmpeg /usr/local/bin/ffprobe /usr/local/bin/ffprobe
95+ COPY --from=ffmpeg /usr/local/nginx /usr/local/nginx
96+ COPY --from=ffmpeg /usr/local/lib /usr/local/lib
97+
98+ RUN apk add --no-cache --update libssl1.0 libxml2 libxslt pcre apache2-utils lua luajit certbot && \
99+ ffmpeg -buildconf
100+
179101ADD templates /templates
180102ADD favicon.ico /usr/local/nginx/html/favicon.ico
181103ADD run.sh /run.sh
@@ -188,7 +110,7 @@ RUN mkdir /usr/local/nginx/conf/vhost && \
188110 chmod +x /run.sh && \
189111 chmod +x /snapshot.sh && \
190112 chmod 777 /snapshot.sh
191-
113+
192114ENV WORKER_PROCESSES=1 \
193115 WORKER_CONNECTIONS=1024 \
194116
@@ -261,4 +183,4 @@ ENV WORKER_PROCESSES=1 \
261183 PLAYER_GA_ACCOUNT=none \
262184 PLAYER_GA_TRACKERNAME=datarheiEdge
263185
264- CMD ["/run.sh" ]
186+ CMD ["/run.sh" ]
0 commit comments