-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
77 lines (64 loc) · 2.45 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
FROM buildpack-deps:stable
LABEL maintainer="Igor Moura <[email protected]>"
# Versions of Nginx to use
ENV NGINX_VERSION nginx-1.16.1
# Install dependencies
RUN apt-get update && \
apt-get install -y ca-certificates openssl libssl-dev htop ffmpeg && \
rm -rf /var/lib/apt/lists/*
# Download and decompress Nginx
RUN mkdir -p /tmp/build/nginx && \
cd /tmp/build/nginx && \
wget -O ${NGINX_VERSION}.tar.gz https://nginx.org/download/${NGINX_VERSION}.tar.gz && \
tar -zxf ${NGINX_VERSION}.tar.gz
# Download and decompress RTMP module
RUN mkdir -p /tmp/build/nginx-rtmp-module && \
cd /tmp/build/nginx-rtmp-module && \
git clone git:/ut0mt8/nginx-rtmp-module.git && \
cd nginx-rtmp-module
# Build and install Nginx
# The default puts everything under /usr/local/nginx, so it's needed to change
# it explicitly. Not just for order but to have it in the PATH
RUN cd /tmp/build/nginx/${NGINX_VERSION} && \
./configure \
--sbin-path=/usr/local/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx/nginx.lock \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/tmp/nginx-client-body \
--with-cc-opt="-Wno-implicit-fallthrough" \
--with-http_ssl_module \
--with-threads \
--with-file-aio \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_stub_status_module \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module \
--add-module=/tmp/build/nginx-rtmp-module/nginx-rtmp-module && \
make -j $(getconf _NPROCESSORS_ONLN) && \
make install && \
mkdir /var/lock/nginx && \
rm -rf /tmp/build
RUN mkdir -p /usr/local/nginx/logs && \
touch /usr/local/nginx/logs/error.log
# Setup self-signed cert
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt \
-subj "/C=US/ST=Ohio/L=Columbus/O=Widgets Inc/OU=Some Unit"
# Forward logs to Docker
RUN ln -sf /dev/stdout /var/log/nginx/access.log && \
ln -sf /dev/stderr /var/log/nginx/error.log
# Set up config file
COPY nginx.conf /etc/nginx/nginx.conf
COPY script.sh /script.sh
# Set up SSL files
COPY fullchain.pem /etc/ssl/certs/fullchain.pem
COPY privkey.pem /etc/ssl/private/privkey.pem
RUN mkdir -p /home/recordings
EXPOSE 1935
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]