docker-nginx-rtmp/Dockerfile

97 lines
2.4 KiB
Docker
Raw Normal View History

FROM alpine:3.4
LABEL author Alfred Gutierrez <alf.g.jr@gmail.com>
2016-10-24 01:49:28 +00:00
ENV NGINX_VERSION 1.13.9
ENV NGINX_RTMP_VERSION 1.2.1
ENV FFMPEG_VERSION 3.4.2
2016-10-24 01:49:28 +00:00
EXPOSE 1935
EXPOSE 80
RUN mkdir -p /opt/data && mkdir /www
# Build dependencies.
2016-10-24 01:49:28 +00:00
RUN apk update && apk add \
binutils \
binutils-libs \
build-base \
ca-certificates \
gcc \
libc-dev \
libgcc \
make \
musl-dev \
openssl \
openssl-dev \
pcre \
pcre-dev \
pkgconf \
pkgconfig \
zlib-dev
2016-10-24 01:49:28 +00:00
# Get nginx source.
RUN cd /tmp && \
wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar zxf nginx-${NGINX_VERSION}.tar.gz && \
rm nginx-${NGINX_VERSION}.tar.gz
2016-10-24 01:49:28 +00:00
# Get nginx-rtmp module.
RUN cd /tmp && \
wget https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_VERSION}.tar.gz && \
tar zxf v${NGINX_RTMP_VERSION}.tar.gz && rm v${NGINX_RTMP_VERSION}.tar.gz
2016-10-24 01:49:28 +00:00
# Compile nginx with nginx-rtmp module.
RUN cd /tmp/nginx-${NGINX_VERSION} && \
./configure \
2016-10-24 01:49:28 +00:00
--prefix=/opt/nginx \
--add-module=/tmp/nginx-rtmp-module-${NGINX_RTMP_VERSION} \
--conf-path=/opt/nginx/nginx.conf \
--error-log-path=/opt/nginx/logs/error.log \
--http-log-path=/opt/nginx/logs/access.log \
--with-debug \
cd /tmp/nginx-${NGINX_VERSION} && make && make install
2016-10-24 01:49:28 +00:00
# FFmpeg dependencies.
2017-01-06 07:14:50 +00:00
RUN apk add --update nasm yasm-dev lame-dev libogg-dev x264-dev libvpx-dev libvorbis-dev x265-dev freetype-dev libass-dev libwebp-dev rtmpdump-dev libtheora-dev opus-dev
2016-10-24 01:49:28 +00:00
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk add --update fdk-aac-dev
# Get FFmpeg source.
RUN cd /tmp/ && \
wget http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
tar zxf ffmpeg-${FFMPEG_VERSION}.tar.gz && rm ffmpeg-${FFMPEG_VERSION}.tar.gz
2016-10-24 01:49:28 +00:00
# Compile ffmpeg.
RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \
2016-10-24 02:17:32 +00:00
./configure \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--enable-small \
--enable-libmp3lame \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libtheora \
--enable-libvorbis \
--enable-libopus \
--enable-libfdk-aac \
--enable-libass \
--enable-libwebp \
--enable-librtmp \
--enable-postproc \
--enable-avresample \
--enable-libfreetype \
--enable-openssl \
--disable-debug && \
make && make install && make distclean
2016-10-24 01:49:28 +00:00
# Cleanup.
RUN rm -rf /var/cache/* /tmp/*
# Add NGINX config and static files.
2016-10-24 01:49:28 +00:00
ADD nginx.conf /opt/nginx/nginx.conf
ADD static /www/static
CMD ["/opt/nginx/sbin/nginx"]