Skip to content

Commit

Permalink
Merge pull request #12 from phily245/tidy-up
Browse files Browse the repository at this point in the history
Merge Some Run Steps Together
  • Loading branch information
phily245 authored Oct 25, 2020
2 parents bd843da + 1ffba37 commit cacc837
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ FROM debian:buster-slim
ENV NGINX_VERSION=1.18.0
ENV CUSTOM_MODULES "--with-file-aio --with-http_auth_request_module --with-http_ssl_module"

WORKDIR /tmp

RUN apt update && \
apt install -y \
wget \
Expand All @@ -15,36 +17,28 @@ RUN apt update && \
unzip \
zlib1g-dev

RUN addgroup --system --gid 1001 nginx \
&& adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 1001 nginx

WORKDIR /tmp

RUN wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz

RUN echo $(pwd)

RUN tar -xzvf nginx-$NGINX_VERSION.tar.gz

RUN git clone "https://github.com/sergey-dryabzhinsky/nginx-rtmp-module.git"

RUN cd nginx-$NGINX_VERSION && ./configure --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --add-module=/tmp/nginx-rtmp-module $CUSTOM_MODULES

RUN cd nginx-$NGINX_VERSION && make && make install
RUN wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz && \
git clone "https://github.com/sergey-dryabzhinsky/nginx-rtmp-module.git"

RUN addgroup --system --gid 1001 nginx && \
adduser --system --disabled-login --ingroup nginx --no-create-home --home /nonexistent --gecos "nginx user" --shell /bin/false --uid 1001 nginx && \
mkdir -p /home/videos/vod && \
mkdir -p /home/videos/recordings && \
touch /home/videos/recordings/auth && \
tar -xzvf nginx-$NGINX_VERSION.tar.gz && \
cd nginx-$NGINX_VERSION && \
./configure --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --add-module=/tmp/nginx-rtmp-module $CUSTOM_MODULES && \
make && \
make install && \
rm -rf nginx*

COPY templates/nginx/nginx.conf /etc/nginx/nginx.conf

ARG RTMP_AUTH_URL=http://localhost/auth
ARG HLS_AUTH_URL=http://localhost/auth

RUN sed -i "s/proxy_pass http:\/\/localhost\/rtmp-auth;/proxy_pass $(printf '%s\n' "$RTMP_AUTH_URL" | sed -e 's/[\/&]/\\&/g');/g" /etc/nginx/nginx.conf
RUN sed -i "s/proxy_pass http:\/\/localhost\/hls-auth;/proxy_pass $(printf '%s\n' "$HLS_AUTH_URL" | sed -e 's/[\/&]/\\&/g');/g" /etc/nginx/nginx.conf

RUN mkdir -p /home/videos/vod && mkdir -p /home/videos/recordings

RUN touch /home/videos/recordings/auth

RUN rm -rf nginx*
RUN sed -i "s/proxy_pass http:\/\/localhost\/rtmp-auth;/proxy_pass $(printf '%s\n' "$RTMP_AUTH_URL" | sed -e 's/[\/&]/\\&/g');/g" /etc/nginx/nginx.conf && \
sed -i "s/proxy_pass http:\/\/localhost\/hls-auth;/proxy_pass $(printf '%s\n' "$HLS_AUTH_URL" | sed -e 's/[\/&]/\\&/g');/g" /etc/nginx/nginx.conf

RUN nginx -t

Expand Down

0 comments on commit cacc837

Please sign in to comment.