├── Dockerfile ├── README.md ├── nginx.conf └── renovate.json /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.9 as build 2 | 3 | RUN apk add --no-cache curl build-base openssl openssl-dev zlib-dev linux-headers pcre-dev luajit luajit-dev ffmpeg ffmpeg-dev libjpeg-turbo libjpeg-turbo-dev 4 | RUN mkdir nginx nginx-vod-module nginx-lua-module ngx_devel_kit nginx-rtmp-module nginx-thumb-module 5 | 6 | ENV NGINX_VERSION 1.14.2 7 | ENV VOD_MODULE_VERSION 1.24 8 | ENV LUA_MODULE_VERSION v0.10.14 9 | ENV DEV_MODULE_VERSION v0.3.0 10 | ENV RTMP_MODULE_VERSION v1.2.1 11 | ENV THUMB_MODULE_VERSION 0.9.0 12 | 13 | RUN curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C nginx --strip 1 -xz 14 | RUN curl -sL https://github.com/kaltura/nginx-vod-module/archive/${VOD_MODULE_VERSION}.tar.gz | tar -C nginx-vod-module --strip 1 -xz 15 | RUN curl -sL https://github.com/openresty/lua-nginx-module/archive/${LUA_MODULE_VERSION}.tar.gz | tar -C nginx-lua-module --strip 1 -xz 16 | RUN curl -sL https://github.com/simpl/ngx_devel_kit/archive/${DEV_MODULE_VERSION}.tar.gz | tar -C ngx_devel_kit --strip 1 -xz 17 | RUN curl -sL https://github.com/arut/nginx-rtmp-module/archive/${RTMP_MODULE_VERSION}.tar.gz | tar -C nginx-rtmp-module --strip 1 -xz 18 | RUN curl -sL https://github.com/wandenberg/nginx-video-thumbextractor-module/archive/${THUMB_MODULE_VERSION}.tar.gz | tar -C nginx-thumb-module --strip 1 -xz 19 | 20 | ENV LUAJIT_INC /usr/include/luajit-2.1/ 21 | ENV LUAJIT_LIB /usr/lib 22 | 23 | WORKDIR /nginx 24 | RUN ./configure --prefix=/usr/local/nginx \ 25 | --with-ld-opt="-Wl,-rpath,/usr/lib/libluajit-5.1.so" \ 26 | --add-module=../nginx-vod-module \ 27 | --add-module=../ngx_devel_kit \ 28 | --add-module=../nginx-lua-module \ 29 | --add-module=../nginx-thumb-module \ 30 | --add-module=../nginx-rtmp-module \ 31 | --with-file-aio \ 32 | --with-threads \ 33 | --with-cc-opt="-O3" 34 | RUN make 35 | RUN make install 36 | 37 | FROM alpine:3.9 38 | RUN apk add --no-cache ca-certificates openssl pcre zlib luajit ffmpeg libjpeg-turbo 39 | COPY --from=build /usr/local/nginx /usr/local/nginx 40 | COPY nginx.conf /usr/local/nginx/conf/nginx.conf 41 | RUN rm -rf /usr/local/nginx/html /usr/loca/nginx/conf/*.default 42 | ENTRYPOINT ["/usr/local/nginx/sbin/nginx"] 43 | CMD ["-g", "daemon off;"] 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | video-nginx 2 | =========== 3 | 4 | This repository contains a Dockerfile for building nginx optimized for 5 | video-delivery. It contains: 6 | 7 | - [lua-nginx-module](https://github.com/openresty/lua-nginx-module) (with 8 | luajit) for Lua scripting 9 | - [nginx-rtmp-module](https://github.com/arut/nginx-rtmp-module) for live 10 | streaming (with on-the-fly HLS/DASH segmenting) 11 | - [nginx-video-thumbextractor-module](https://github.com/wandenberg/nginx-video-thumbextractor-module) 12 | for thumb generation 13 | - [nginx-vod-module](https://github.com/kaltura/nginx-vod-module) for 14 | on-the-fly video segmenting 15 | 16 | The image is available on Docker Hub: 17 | https://hub.docker.com/r/fsouza/video-nginx/. 18 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | worker_processes auto; 2 | 3 | error_log stderr; 4 | 5 | events { 6 | worker_connections 1024; 7 | } 8 | 9 | http { 10 | include mime.types; 11 | default_type application/octet-stream; 12 | 13 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 14 | '$status $body_bytes_sent "$http_referer" ' 15 | '"$http_user_agent" "$http_x_forwarded_for"'; 16 | 17 | access_log /dev/stdout main; 18 | 19 | sendfile on; 20 | keepalive_timeout 65; 21 | gzip on; 22 | 23 | server { 24 | listen 80; 25 | server_name localhost; 26 | 27 | location / { 28 | root html; 29 | index index.html index.htm; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "config:base" 4 | ] 5 | } 6 | --------------------------------------------------------------------------------