REFACTOR: made custom nginx module instead of prebuilt

This commit is contained in:
2025-03-03 21:03:21 +00:00
parent 5ab326ffc7
commit 03decdcede

View File

@@ -1,7 +1,36 @@
FROM tiangolo/nginx-rtmp
FROM debian:bullseye
COPY nginx.conf /etc/nginx/nginx.conf
# Install dependencies
RUN apt update && apt install -y \
build-essential \
libpcre3 libpcre3-dev \
zlib1g zlib1g-dev \
libssl-dev \
curl wget git
# Define versions
ENV NGINX_VERSION=1.24.0
ENV NGINX_RTMP_MODULE_VERSION=1.2.2
# Download and compile NGINX with RTMP & auth_request module
RUN wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && \
tar -zxvf nginx-${NGINX_VERSION}.tar.gz && \
git clone https://github.com/arut/nginx-rtmp-module.git && \
cd nginx-${NGINX_VERSION} && \
./configure --with-http_auth_request_module --add-module=../nginx-rtmp-module && \
make -j$(nproc) && \
make install
# Create required directories for logs
RUN mkdir -p /var/log/nginx && \
touch /var/log/nginx/error.log && \
touch /var/log/nginx/access.log
# Copy custom NGINX config
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
# Expose necessary ports
EXPOSE 1935 8080
# Start the Nginx server
CMD [ "nginx", "-g", "daemon off;" ]
# Start NGINX
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]