-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
142 lines (124 loc) · 3.49 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
ARG NGINX_VERSION=1.21.3
##########################
# build image
##########################
FROM nginx:${NGINX_VERSION}-alpine as build
ARG FFMPEG_VERSION=4.4
ARG VOD_MODULE_VERSION=1.29
ARG AWS_AUTH_MODULE_VERSION=master
ARG PREFIX=/opt/ffmpeg
ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib
ARG MAKEFLAGS="-j4"
RUN apk add --no-cache \
git \
curl \
build-base \
openssl \
openssl-dev \
zlib-dev \
linux-headers \
pcre-dev \
coreutils \
freetype-dev \
gcc \
lame-dev \
libogg-dev \
libass \
libass-dev \
libvpx-dev \
libvorbis-dev \
libwebp-dev \
libtheora-dev \
opus-dev \
pkgconf \
pkgconfig \
rtmpdump-dev \
x264-dev \
x265-dev \
yasm
# Get fdk-aac from community.
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \
apk add --update fdk-aac-dev
# Get rav1e from testing.
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk add --update rav1e-dev
# Get ffmpeg source.
RUN mkdir /ffmpeg
RUN curl -sL http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz | tar -C /ffmpeg --strip 1 -xz
# Compile ffmpeg.
WORKDIR /ffmpeg
RUN ./configure \
--enable-version3 \
--enable-gpl \
--enable-nonfree \
--enable-small \
--enable-libmp3lame \
--enable-libx264 \
--enable-libx265 \
--enable-libvpx \
--enable-libtheora \
--enable-libvorbis \
--enable-libopus \
--enable-libfdk-aac \
--enable-libass \
--enable-libwebp \
--enable-librtmp \
--enable-librav1e \
--enable-postproc \
--enable-libfreetype \
--enable-openssl \
--disable-debug \
--disable-doc \
--disable-ffplay \
--extra-cflags="-I${PREFIX}/include" \
--extra-ldflags="-L${PREFIX}/lib" \
--extra-libs="-lpthread -lm" \
--prefix="${PREFIX}"
RUN make && make install && make distclean
RUN mkdir /nginx
RUN curl -sL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz | tar -C /nginx --strip 1 -xz
# Get nginx-vod-module
RUN git clone --depth=1 --branch=$VOD_MODULE_VERSION https://github.com/kaltura/nginx-vod-module.git /nginx-vod-module
# Get nginx-aws-auth-module
RUN git clone --depth=1 --branch=$AWS_AUTH_MODULE_VERSION https://github.com/kaltura/nginx-aws-auth-module.git /nginx-aws-auth-module
# Compile nginx.
WORKDIR /nginx
RUN NGINX_ARGS=$(nginx -V 2>&1 | sed -n -e 's/^.*arguments: //p') \
./configure \
--with-compat \
--add-dynamic-module=/nginx-vod-module \
--add-dynamic-module=/nginx-aws-auth-module \
--with-file-aio \
--with-threads \
--with-cc-opt="-O3 -mpopcnt" \
${NGINX_ARGS}
RUN make modules
##########################
# nginx image
##########################
FROM nginx:${NGINX_VERSION}-alpine
LABEL MAINTAINER Maxime Epain <me@maxep.me>
LABEL description "Nginx docker image with VoD module "
LABEL org.opencontainers.image.source https://github.com/LYL-Radio/nginx-vod-docker
ENV PATH=/opt/ffmpeg/bin:$PATH
RUN apk add --no-cache \
zlib \
ca-certificates \
openssl \
pcre \
lame \
libogg \
libass \
libvpx \
libvorbis \
libwebp \
libtheora \
opus \
rtmpdump \
x264-dev \
x265-dev
COPY --from=build /opt/ffmpeg /opt/ffmpeg
COPY --from=build /usr/lib/libfdk-aac.so.2 /usr/lib/libfdk-aac.so.2
COPY --from=build /usr/lib/librav1e.so /usr/lib/librav1e.so
COPY --from=build /nginx/objs/ngx_http_vod_module.so /etc/nginx/modules/
COPY --from=build /nginx/objs/ngx_http_aws_auth_module.so /etc/nginx/modules/