From 5ec75a7ce52bd6f0ec7f2c305e763572fc2f2641 Mon Sep 17 00:00:00 2001 From: Eric Meehan Date: Fri, 22 May 2026 18:33:49 -0400 Subject: [PATCH] Initial commit --- .gitignore | 1 + Dockerfile | 39 +++++++++++++++++++++++++++++++++++++++ Dockerfile.alpine | 11 +++++++++++ README.md | 4 ++++ 4 files changed, 55 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Dockerfile.alpine create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5f7ba3c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +conf/* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6c82523 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:xenial + +# Building in the docker image increases the size because all the deps are installed +# if these are done in separate RUN commands they get put into diff. layers and removing later has no effect apparently +# as a result, all build/remove commands are pushed into one RUN command, the docker image goes from 808 MB to 300 by doing so +RUN apt-get -y update; \ + apt-get -y install software-properties-common dpkg-dev git; \ + add-apt-repository -y ppa:nginx/stable; \ + sed -i '/^#.* deb-src /s/^#//' /etc/apt/sources.list.d/nginx-ubuntu-stable-xenial.list; \ + apt-get -y update; \ + apt-get -y source nginx; \ + cd $(find . -maxdepth 1 -type d -name "nginx*") && \ + ls -ahl && \ + git clone https://github.com/arut/nginx-rtmp-module.git && \ + sed -i "s|common_configure_flags := \\\|common_configure_flags := \\\--add-module=$(cd nginx-rtmp-module && pwd) \\\|" debian/rules && \ + cat debian/rules && echo "^^" && \ + apt-get -y build-dep nginx && \ + dpkg-buildpackage -b && \ + cd .. && ls -ahl && \ + dpkg --install $(find . -maxdepth 1 -type f -name "nginx-common*") && \ + dpkg --install $(find . -maxdepth 1 -type f -name "libnginx*") && \ + dpkg --install $(find . -maxdepth 1 -type f -name "nginx-full*"); \ + apt-get -y remove software-properties-common dpkg-dev git; \ + apt-get -y install aptitude; \ + aptitude -y markauto $(apt-cache showsrc nginx | sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),*\|\[[^]]*\]//g'); \ + apt-get -y autoremove; \ + apt-get -y remove aptitude; \ + apt-get -y autoremove; \ + rm -rf ./*nginx* + +# forward request and error logs to docker log collector +RUN ln -sf /dev/stdout /var/log/nginx/access.log +RUN ln -sf /dev/stderr /var/log/nginx/error.log +RUN rm /etc/nginx/modules-enabled/50-mod-rtmp.conf + +EXPOSE 80 443 1935 +VOLUME ["/etc/nginx", "/var/cache/nginx"] + +CMD ["nginx", "-g", "daemon off;"] diff --git a/Dockerfile.alpine b/Dockerfile.alpine new file mode 100644 index 0000000..d980d37 --- /dev/null +++ b/Dockerfile.alpine @@ -0,0 +1,11 @@ +FROM alpine:3.13.4 as builder +RUN apk add --update build-base git bash gcc make g++ zlib-dev linux-headers pcre-dev openssl-dev +RUN git clone https://github.com/arut/nginx-rtmp-module.git && \ + git clone https://github.com/nginx/nginx.git +RUN cd nginx && ./auto/configure --add-module=../nginx-rtmp-module && make && make install + +FROM alpine:3.13.4 as nginx +RUN apk add --update pcre ffmpeg +COPY --from=builder /usr/local/nginx /usr/local/nginx +ENTRYPOINT ["/usr/local/nginx/sbin/nginx"] +CMD ["-g", "daemon off;"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..7ae5a21 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Nginx RTMP + +A Docker container running nginx with RTMP module based on a [forum post by dodgepong](https://obsproject.com/forum/resources/how-to-set-up-your-own-private-rtmp-server-using-nginx.50/) and the [RTMP module wiki](https://github.com/arut/nginx-rtmp-module/wiki/Building-a-docker-image-with-nginx--rtmp-module) +