Skip to content

Commit 52c92ac

Browse files
committed
Add first tested Dockerfile
1 parent c604dfb commit 52c92ac

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM buildpack-deps:jessie
2+
3+
# Versions of Nginx and nginx-rtmp-module to use
4+
ENV NGINX_VERSION nginx-1.11.3
5+
ENV NGINX_RTMP_MODULE_VERSION 1.1.9
6+
7+
# Install dependencies
8+
RUN apt-get update && \
9+
apt-get install -y ca-certificates openssl libssl-dev && \
10+
rm -rf /var/lib/apt/lists/*
11+
12+
# Download and decompress Nginx
13+
RUN mkdir -p /tmp/build/nginx && \
14+
cd /tmp/build/nginx && \
15+
wget -O ${NGINX_VERSION}.tar.gz https://nginx.org/download/${NGINX_VERSION}.tar.gz && \
16+
tar -zxf ${NGINX_VERSION}.tar.gz
17+
18+
# Download and decompress RTMP module
19+
RUN mkdir -p /tmp/build/nginx-rtmp-module && \
20+
cd /tmp/build/nginx-rtmp-module && \
21+
wget -O nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz https://github.com/arut/nginx-rtmp-module/archive/v${NGINX_RTMP_MODULE_VERSION}.tar.gz && \
22+
tar -zxf nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}.tar.gz && \
23+
cd nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION}
24+
25+
# Build and install Nginx
26+
# The default puts everything under /usr/local/nginx, so it's needed to change
27+
# it explicitly. Not just for order but to have it in the PATH
28+
RUN cd /tmp/build/nginx/${NGINX_VERSION} && \
29+
./configure \
30+
--sbin-path=/usr/local/sbin/nginx \
31+
--conf-path=/etc/nginx/nginx.conf \
32+
--error-log-path=/var/log/nginx/error.log \
33+
--pid-path=/var/run/nginx/nginx.pid \
34+
--lock-path=/var/lock/nginx/nginx.lock \
35+
--http-log-path=/var/log/nginx/access.log \
36+
--http-client-body-temp-path=/tmp/nginx-client-body \
37+
--with-http_ssl_module \
38+
--with-threads \
39+
--with-ipv6 \
40+
--add-module=/tmp/build/nginx-rtmp-module/nginx-rtmp-module-${NGINX_RTMP_MODULE_VERSION} && \
41+
make -j $(getconf _NPROCESSORS_ONLN) && \
42+
make install && \
43+
mkdir /var/lock/nginx && \
44+
rm -rf /tmp/build
45+
46+
# Forward logs to Docker
47+
RUN ln -sf /dev/stdout /var/log/nginx/access.log && \
48+
ln -sf /dev/stderr /var/log/nginx/error.log
49+
50+
# Set up config file
51+
COPY nginx.conf /etc/nginx/nginx.conf
52+
53+
EXPOSE 1935
54+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)