Merge pull request #8 from alfg/nginx-version-cleanup

Bump nginx version and syntax cleanup
This commit is contained in:
Alfred Gutierrez 2018-03-05 22:09:54 -08:00 committed by GitHub
commit b10325c932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 41 additions and 21 deletions

View File

@ -1,7 +1,7 @@
FROM alpine:3.4 FROM alpine:3.4
LABEL author Alfred Gutierrez <alf.g.jr@gmail.com> LABEL author Alfred Gutierrez <alf.g.jr@gmail.com>
ENV NGINX_VERSION 1.13.8 ENV NGINX_VERSION 1.13.9
ENV NGINX_RTMP_VERSION 1.2.1 ENV NGINX_RTMP_VERSION 1.2.1
ENV FFMPEG_VERSION 3.4.2 ENV FFMPEG_VERSION 3.4.2
@ -10,37 +10,56 @@ EXPOSE 80
RUN mkdir -p /opt/data && mkdir /www RUN mkdir -p /opt/data && mkdir /www
# Build dependencies.
RUN apk update && apk add \ RUN apk update && apk add \
gcc binutils-libs binutils build-base libgcc make pkgconf pkgconfig \ binutils \
openssl openssl-dev ca-certificates pcre \ binutils-libs \
musl-dev libc-dev pcre-dev zlib-dev build-base \
ca-certificates \
gcc \
libc-dev \
libgcc \
make \
musl-dev \
openssl \
openssl-dev \
pcre \
pcre-dev \
pkgconf \
pkgconfig \
zlib-dev
# Get nginx source. # Get nginx source.
RUN cd /tmp && wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz \ RUN cd /tmp && \
&& tar zxf nginx-${NGINX_VERSION}.tar.gz \ wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
&& rm nginx-${NGINX_VERSION}.tar.gz tar zxf nginx-${NGINX_VERSION}.tar.gz && \
rm nginx-${NGINX_VERSION}.tar.gz
# Get nginx-rtmp module. # Get nginx-rtmp module.
RUN cd /tmp && wget https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_VERSION}.tar.gz \ RUN cd /tmp && \
&& tar zxf v${NGINX_RTMP_VERSION}.tar.gz && rm v${NGINX_RTMP_VERSION}.tar.gz 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
# Compile nginx with nginx-rtmp module. # Compile nginx with nginx-rtmp module.
RUN cd /tmp/nginx-${NGINX_VERSION} \ RUN cd /tmp/nginx-${NGINX_VERSION} && \
&& ./configure \ ./configure \
--prefix=/opt/nginx \ --prefix=/opt/nginx \
--add-module=/tmp/nginx-rtmp-module-${NGINX_RTMP_VERSION} \ --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 \ --conf-path=/opt/nginx/nginx.conf \
--with-debug --error-log-path=/opt/nginx/logs/error.log \
RUN cd /tmp/nginx-${NGINX_VERSION} && make && make install --http-log-path=/opt/nginx/logs/access.log \
--with-debug && \
cd /tmp/nginx-${NGINX_VERSION} && make && make install
# ffmpeg dependencies. # FFmpeg dependencies.
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 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
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk add --update fdk-aac-dev RUN apk add --update fdk-aac-dev
# Get ffmpeg source. # Get FFmpeg source.
RUN cd /tmp/ && wget http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz \ RUN cd /tmp/ && \
&& tar zxf ffmpeg-${FFMPEG_VERSION}.tar.gz && rm ffmpeg-${FFMPEG_VERSION}.tar.gz wget http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
tar zxf ffmpeg-${FFMPEG_VERSION}.tar.gz && rm ffmpeg-${FFMPEG_VERSION}.tar.gz
# Compile ffmpeg. # Compile ffmpeg.
RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \ RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \
@ -64,12 +83,13 @@ RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \
--enable-avresample \ --enable-avresample \
--enable-libfreetype \ --enable-libfreetype \
--enable-openssl \ --enable-openssl \
--disable-debug \ --disable-debug && \
&& make && make install && make distclean make && make install && make distclean
# Cleanup. # Cleanup.
RUN rm -rf /var/cache/* /tmp/* RUN rm -rf /var/cache/* /tmp/*
# Add NGINX config and static files.
ADD nginx.conf /opt/nginx/nginx.conf ADD nginx.conf /opt/nginx/nginx.conf
ADD static /www/static ADD static /www/static

View File

@ -2,7 +2,7 @@
A Dockerfile installing NGINX, nginx-rtmp-module and FFmpeg from source with A Dockerfile installing NGINX, nginx-rtmp-module and FFmpeg from source with
default settings for HLS live streaming. Built on Alpine Linux. default settings for HLS live streaming. Built on Alpine Linux.
* Nginx 1.13.8 (compiled from source) * Nginx 1.13.9 (compiled from source)
* nginx-rtmp-module 1.2.1 (compiled from source) * nginx-rtmp-module 1.2.1 (compiled from source)
* ffmpeg 3.4.2 (compiled from source) * ffmpeg 3.4.2 (compiled from source)
* Default HLS settings (See: [nginx.conf](nginx.conf)) * Default HLS settings (See: [nginx.conf](nginx.conf))