Add: Basic Docker based on Kaltura HLS Nginx Module
This commit is contained in:
commit
3d504723c2
38
Dockerfile
Normal file
38
Dockerfile
Normal file
@ -0,0 +1,38 @@
|
||||
FROM alpine:latest AS base_image
|
||||
|
||||
FROM base_image AS build
|
||||
|
||||
RUN apk add --no-cache curl build-base openssl openssl-dev zlib-dev linux-headers pcre-dev ffmpeg ffmpeg-dev
|
||||
|
||||
RUN mkdir nginx nginx-vod-module
|
||||
|
||||
ARG NGINX_VERSION=1.25.0
|
||||
ARG VOD_MODULE_VERSION=6c305a78b7ab6e4312279bea5c45741bb54a713b
|
||||
|
||||
RUN curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C /nginx --strip 1 -xz
|
||||
RUN curl -sL https://github.com/kaltura/nginx-vod-module/archive/${VOD_MODULE_VERSION}.tar.gz | tar -C /nginx-vod-module --strip 1 -xz
|
||||
|
||||
WORKDIR /nginx
|
||||
|
||||
RUN ./configure --prefix=/usr/local/nginx \
|
||||
--add-module=../nginx-vod-module \
|
||||
--with-http_ssl_module \
|
||||
--with-file-aio \
|
||||
--with-threads \
|
||||
--with-cc-opt="-O3"
|
||||
|
||||
RUN make
|
||||
|
||||
RUN make install
|
||||
|
||||
RUN rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
|
||||
|
||||
FROM base_image
|
||||
|
||||
RUN apk add --no-cache ca-certificates openssl pcre zlib ffmpeg
|
||||
|
||||
COPY --from=build /usr/local/nginx /usr/local/nginx
|
||||
|
||||
ENTRYPOINT ["/usr/local/nginx/sbin/nginx"]
|
||||
|
||||
CMD ["-g", "daemon off;"]
|
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
||||
version: "3"
|
||||
services:
|
||||
vod:
|
||||
image: registry.audio-lab.org/kaltura-nginx
|
||||
restart: always
|
||||
ports:
|
||||
- 8001:80
|
||||
volumes:
|
||||
- ./nginx.conf:/usr/local/nginx/conf/nginx.conf:ro
|
||||
- ./videos/:/var/www/html/videos/:ro
|
84
nginx.conf
Normal file
84
nginx.conf
Normal file
@ -0,0 +1,84 @@
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
|
||||
events {
|
||||
use epoll;
|
||||
}
|
||||
|
||||
http {
|
||||
log_format main '$remote_addr $remote_user [$time_local] "$request" '
|
||||
'$status "$http_referer" "$http_user_agent"';
|
||||
|
||||
access_log /dev/stdout main;
|
||||
error_log stderr debug;
|
||||
|
||||
default_type application/octet-stream;
|
||||
include /usr/local/nginx/conf/mime.types;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
|
||||
vod_mode local;
|
||||
vod_metadata_cache metadata_cache 16m;
|
||||
vod_response_cache response_cache 512m;
|
||||
vod_last_modified_types *;
|
||||
vod_segment_duration 9000;
|
||||
vod_align_segments_to_key_frames on;
|
||||
vod_dash_fragment_file_name_prefix "segment";
|
||||
vod_hls_segment_file_name_prefix "segment";
|
||||
|
||||
vod_manifest_segment_durations_mode accurate;
|
||||
|
||||
open_file_cache max=1000 inactive=5m;
|
||||
open_file_cache_valid 2m;
|
||||
open_file_cache_min_uses 1;
|
||||
open_file_cache_errors on;
|
||||
|
||||
aio on;
|
||||
|
||||
# secure_token_akamai $secure_token {
|
||||
# key RANDOM_HEX;
|
||||
# acl "$secure_token_baseuri_comma*";
|
||||
# param_name token;
|
||||
# }
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
root /var/www/html;
|
||||
|
||||
location ~ ^/videos/.+$ {
|
||||
autoindex on;
|
||||
}
|
||||
|
||||
location /hls/ {
|
||||
vod hls;
|
||||
alias /var/www/html/videos/;
|
||||
|
||||
if ($arg_token) {
|
||||
set $input_token $arg_token;
|
||||
}
|
||||
|
||||
add_header Access-Control-Allow-Headers '*';
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
|
||||
|
||||
#akamai_token_validate $input_token;
|
||||
#akamai_token_validate_key RANDOM_HEX;
|
||||
|
||||
#secure_token $secure_token;
|
||||
#secure_token_types application/vnd.apple.mpegurl;
|
||||
#secure_token_expires_time 100d;
|
||||
#secure_token_query_token_expires_time 1h;
|
||||
}
|
||||
|
||||
location /thumb/ {
|
||||
vod thumb;
|
||||
alias /var/www/html/videos/;
|
||||
add_header Access-Control-Allow-Headers '*';
|
||||
add_header Access-Control-Allow-Origin '*';
|
||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user