forked from datarhei/restreamer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
9,512 additions
and
1,123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,128 +1,149 @@ | ||
FROM node:5.9.0-slim | ||
ARG IMAGE=amd64/debian:stretch-slim | ||
|
||
MAINTAINER datarhei <[email protected]> | ||
|
||
ENV FFMPEG_VERSION=2.8.6 \ | ||
YASM_VERSION=1.3.0 \ | ||
LAME_VERSION=3_99_5 \ | ||
NGINX_VERSION=1.9.9 \ | ||
NGINX_RTMP_VERSION=1.1.7.10 \ | ||
FROM $IMAGE as builder | ||
|
||
SRC="/usr/local" | ||
MAINTAINER datarhei <[email protected]> | ||
|
||
ENV LD_LIBRARY_PATH="${SRC}/lib" \ | ||
PKG_CONFIG_PATH="${SRC}/lib/pkgconfig" \ | ||
ARG NASM_VERSION=2.13.03 | ||
ARG LAME_VERSION=3.100 | ||
# x264 versions from August 2018 onward (> Core 152) seem to have a bug that cuts performance by 50% | ||
ARG X264_VERSION=20180717-2245-stable | ||
ARG FFMPEG_VERSION=4.1 | ||
ARG NGINX_VERSION=1.14.1 | ||
ARG NGINXRTMP_VERSION=1.2.1 | ||
ARG NODE_VERSION=10.13.0 | ||
|
||
BUILDDEPS="autoconf automake gcc g++ libtool make nasm zlib1g-dev libssl-dev xz-utils cmake build-essential libpcre3-dev" | ||
ENV SRC="/usr/local/" \ | ||
LD_LIBRARY_PATH="/usr/local/lib" \ | ||
PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes curl git libpcre3 tar perl ca-certificates ${BUILDDEPS} && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
|
||
# yasm | ||
DIR="$(mktemp -d)" && cd "${DIR}" && \ | ||
curl -LOks "https://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz" && \ | ||
tar xzvf "yasm-${YASM_VERSION}.tar.gz" && \ | ||
cd "yasm-${YASM_VERSION}" && \ | ||
apt-get install -y \ | ||
pkg-config \ | ||
curl \ | ||
libpcre3-dev \ | ||
libtool \ | ||
libssl-dev \ | ||
zlib1g-dev \ | ||
libasound2-dev \ | ||
build-essential | ||
|
||
# nasm | ||
RUN mkdir -p /dist && cd /dist && \ | ||
curl -OL "https://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.xz" && \ | ||
tar -xvJ -f nasm-${NASM_VERSION}.tar.xz && \ | ||
cd nasm-${NASM_VERSION} && \ | ||
./configure && \ | ||
make -j$(nproc) && \ | ||
make install | ||
|
||
# x264 | ||
RUN mkdir -p /dist && cd /dist && \ | ||
curl -OL "http://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264_VERSION}.tar.bz2" && \ | ||
tar -xvj -f x264-snapshot-${X264_VERSION}.tar.bz2 && \ | ||
cd x264-snapshot-${X264_VERSION} && \ | ||
./configure --prefix="${SRC}" --bindir="${SRC}/bin" --enable-shared && \ | ||
make -j$(nproc) && \ | ||
make install | ||
|
||
# libmp3lame | ||
RUN mkdir -p /dist && cd /dist && \ | ||
curl -OL "https://kent.dl.sourceforge.net/project/lame/lame/${LAME_VERSION}/lame-${LAME_VERSION}.tar.gz" && \ | ||
tar -xvz -f lame-${LAME_VERSION}.tar.gz && \ | ||
cd lame-${LAME_VERSION} && \ | ||
./configure --prefix="${SRC}" --bindir="${SRC}/bin" --disable-static --enable-nasm && \ | ||
make -j$(nproc) && \ | ||
make install | ||
|
||
# ffmpeg | ||
RUN mkdir -p /dist && cd /dist && \ | ||
curl -OL "https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz" && \ | ||
tar -xvz -f ffmpeg-${FFMPEG_VERSION}.tar.gz && \ | ||
cd ffmpeg-${FFMPEG_VERSION} && \ | ||
./configure \ | ||
--prefix="${SRC}" \ | ||
--bindir="${SRC}/bin" && \ | ||
make -j"$(nproc)" && \ | ||
make install && \ | ||
make distclean && \ | ||
rm -rf "${DIR}" && \ | ||
|
||
# x264 | ||
DIR="$(mktemp -d)" && cd "${DIR}" && \ | ||
git clone --depth 1 "git://git.videolan.org/x264" && \ | ||
cd x264 && \ | ||
./configure \ | ||
--prefix="${SRC}" \ | ||
--bindir="${SRC}/bin" \ | ||
--enable-static \ | ||
--disable-cli && \ | ||
make -j"$(nproc)" && \ | ||
make install && \ | ||
make distclean && \ | ||
rm -rf "${DIR}" && \ | ||
|
||
# libmp3lame | ||
DIR="$(mktemp -d)" && cd "${DIR}" && \ | ||
curl -LOks "https://github.com/rbrito/lame/archive/RELEASE__${LAME_VERSION}.tar.gz" && \ | ||
tar xzvf "RELEASE__${LAME_VERSION}.tar.gz" && \ | ||
cd "lame-RELEASE__${LAME_VERSION}" && \ | ||
./configure \ | ||
--prefix="${SRC}" \ | ||
--bindir="${SRC}/bin" \ | ||
--enable-nasm \ | ||
--disable-shared && \ | ||
make -j"$(nproc)" && \ | ||
make install && \ | ||
make distclean && \ | ||
rm -rf "${DIR}" && \ | ||
|
||
# ffmpeg | ||
# patch: andrew-shulgin Ignore invalid sprop-parameter-sets missing PPS | ||
DIR="$(mktemp -d)" && cd "${DIR}" && \ | ||
curl -LOks "https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz" && \ | ||
tar xzvf "ffmpeg-${FFMPEG_VERSION}.tar.gz" && \ | ||
cd "ffmpeg-${FFMPEG_VERSION}" && \ | ||
curl -Lks "https://github.com/FFmpeg/FFmpeg/commit/1c7e2cf9d33968375ee4025d2279c937e147dae2.patch" | patch -p1 && \ | ||
./configure \ | ||
--prefix="${SRC}" \ | ||
--bindir="${SRC}/bin" \ | ||
--extra-cflags="-I${SRC}/include" \ | ||
--extra-ldflags="-L${SRC}/lib" \ | ||
--extra-libs=-ldl \ | ||
--prefix="${SRC}" \ | ||
--enable-nonfree \ | ||
--enable-gpl \ | ||
--enable-version3 \ | ||
--enable-avresample \ | ||
--enable-libmp3lame \ | ||
--enable-libx264 \ | ||
--enable-openssl \ | ||
--enable-postproc \ | ||
--enable-small \ | ||
--enable-static \ | ||
--disable-debug \ | ||
--disable-doc \ | ||
--disable-ffserver && \ | ||
make -j"$(nproc)" && \ | ||
make install && \ | ||
make distclean && \ | ||
hash -r && \ | ||
cd tools && \ | ||
make qt-faststart && \ | ||
cp qt-faststart "${SRC}/bin" && \ | ||
rm -rf "${DIR}" && \ | ||
echo "${SRC}/lib" > "/etc/ld.so.conf.d/libc.conf" && \ | ||
ffmpeg -buildconf && \ | ||
|
||
# nginx-rtmp | ||
DIR="$(mktemp -d)" && cd "${DIR}" && \ | ||
curl -LOks "https://github.com/nginx/nginx/archive/release-${NGINX_VERSION}.tar.gz" && \ | ||
tar xzvf "release-${NGINX_VERSION}.tar.gz" && \ | ||
curl -LOks "https://github.com/sergey-dryabzhinsky/nginx-rtmp-module/archive/v${NGINX_RTMP_VERSION}.tar.gz" && \ | ||
tar xzvf "v${NGINX_RTMP_VERSION}.tar.gz" && \ | ||
cd "nginx-release-${NGINX_VERSION}" && \ | ||
auto/configure \ | ||
--with-http_ssl_module \ | ||
--add-module="../nginx-rtmp-module-${NGINX_RTMP_VERSION}" && \ | ||
make -j"$(nproc)" && \ | ||
make install && \ | ||
rm -rf "${DIR}" && \ | ||
|
||
apt-get purge -y --auto-remove ${BUILDDEPS} && \ | ||
rm -rf /tmp/* | ||
--disable-shared && \ | ||
make -j$(nproc) && \ | ||
make install | ||
|
||
# nginx-rtmp | ||
RUN mkdir -p /dist && cd /dist && \ | ||
curl -OL "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz" && \ | ||
tar -xvz -f "nginx-${NGINX_VERSION}.tar.gz" && \ | ||
curl -OL "https://github.com/arut/nginx-rtmp-module/archive/v${NGINXRTMP_VERSION}.tar.gz" && \ | ||
tar -xvz -f "v${NGINXRTMP_VERSION}.tar.gz" && \ | ||
cd nginx-${NGINX_VERSION} && \ | ||
./configure --prefix=/usr/local/nginx --with-http_ssl_module --add-module=/dist/nginx-rtmp-module-${NGINXRTMP_VERSION} && \ | ||
make -j$(nproc) && \ | ||
make install | ||
|
||
# node.js | ||
RUN mkdir -p /dist && cd /dist && \ | ||
curl -OL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" && \ | ||
tar -xvJ -f "node-v${NODE_VERSION}-linux-x64.tar.xz" && \ | ||
cd node-v${NODE_VERSION}-linux-x64 && \ | ||
cp -R bin /usr/local && \ | ||
cp -R lib /usr/local | ||
|
||
RUN rm -r /dist && \ | ||
apt-get remove -y \ | ||
pkg-config \ | ||
curl \ | ||
libpcre3-dev \ | ||
libtool \ | ||
libssl-dev \ | ||
zlib1g-dev \ | ||
build-essential && \ | ||
apt autoremove -y | ||
|
||
FROM $IMAGE | ||
|
||
COPY --from=builder /usr/local/bin /usr/local/bin | ||
COPY --from=builder /usr/local/nginx /usr/local/nginx | ||
COPY --from=builder /usr/local/lib /usr/local/lib | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
ca-certificates \ | ||
git \ | ||
procps \ | ||
libpcre3 \ | ||
libssl1.1 \ | ||
zlib1g \ | ||
v4l-utils \ | ||
libv4l-0 \ | ||
alsa-utils | ||
|
||
COPY . /restreamer | ||
WORKDIR /restreamer | ||
|
||
RUN npm install -g bower grunt grunt-cli nodemon public-ip eslint && \ | ||
RUN cd /restreamer && \ | ||
npm install -g bower grunt grunt-cli nodemon eslint && \ | ||
npm install && \ | ||
grunt build && \ | ||
npm prune --production && \ | ||
npm cache clean && \ | ||
bower cache clean --allow-root | ||
npm cache verify && \ | ||
bower cache clean --allow-root && \ | ||
npm uninstall -g bower grunt grunt-cli nodemon eslint && \ | ||
npm prune --production && \ | ||
apt-get remove -y \ | ||
git \ | ||
curl && \ | ||
apt autoremove -y | ||
|
||
ENV RS_USERNAME admin | ||
ENV RS_PASSWORD datarhei | ||
|
@@ -131,3 +152,4 @@ EXPOSE 8080 | |
VOLUME ["/restreamer/db"] | ||
|
||
CMD ["./run.sh"] | ||
|
Oops, something went wrong.