Initial version

This commit is contained in:
Knut Ahlers 2020-02-03 21:50:04 +01:00
commit 5b58ef69cd
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E
3 changed files with 92 additions and 0 deletions

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
FROM alpine:latest as fetch
RUN set -ex \
&& apk --no-cache add \
ca-certificates \
curl \
&& curl -sSfLo /tmp/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64" \
&& chmod +x \
/tmp/dumb-init
FROM alpine:latest
RUN set -ex \
&& apk --no-cache add \
bash \
nginx \
nginx-mod-rtmp
COPY --from=fetch /tmp/dumb-init /usr/local/bin/
COPY docker-entrypoint.sh /usr/local/bin/
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 1935
VOLUME ["/data"]
CMD ["/usr/local/bin/docker-entrypoint.sh"]

7
docker-entrypoint.sh Executable file
View file

@ -0,0 +1,7 @@
#!/usr/local/bin/dumb-init /bin/bash
set -euxo pipefail
# Ensure nginx can work with the /data dir
chown -R nginx: /data
exec nginx -g "daemon off;"

58
nginx.conf Normal file
View file

@ -0,0 +1,58 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
include /etc/nginx/modules/rtmp.conf;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80 default_server;
server_name localhost;
types {
application/vnd.apple.mpegurl m3u8;
}
root /data;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
}
rtmp {
server {
listen 1935;
application hls {
live on;
hls on;
hls_fragment 1m;
hls_fragment_naming system;
hls_fragment_slicing aligned;
hls_path /data;
hls_playlist_length 24h;
hls_nested on;
}
}
}