forked from AirenSoft/OvenMediaEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
198 lines (178 loc) · 7.47 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
FROM ubuntu:20.04 AS base
## Install libraries by package
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y tzdata
FROM base AS build
WORKDIR /tmp
ARG PREFIX=/opt/ovenmediaengine
ARG MAKEFLAGS="-j16"
ENV OME_VERSION=master \
OPENSSL_VERSION=3.0.1 \
SRTP_VERSION=2.4.2 \
SRT_VERSION=1.4.4 \
OPUS_VERSION=1.1.3 \
OPENH264_VERSION=2.1.1 \
VPX_VERSION=1.7.0 \
FDKAAC_VERSION=0.1.5 \
FFMPEG_VERSION=4.3.2 \
JEMALLOC_VERSION=5.2.1 \
PCRE2_VERSION=10.39
## Install build utils
RUN apt-get -y install build-essential nasm autoconf libtool zlib1g-dev tclsh cmake curl pkg-config bc uuid-dev
## Build OpenSSL
RUN \
DIR=/tmp/openssl && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/openssl/openssl/archive/openssl-${OPENSSL_VERSION}.tar.gz | tar -xz --strip-components=1 && \
./config --prefix="${PREFIX}" --openssldir="${PREFIX}" -Wl,-rpath="${PREFIX}/lib" shared no-idea no-mdc2 no-rc5 no-ec2m no-ecdh no-ecdsa no-async && \
make && \
make install_sw && \
rm -rf ${DIR} && \
rm -rf ${PREFIX}/bin
## Build SRTP
RUN \
ln -s ${PREFIX}/lib64 ${PREFIX}/lib && \
DIR=/tmp/srtp && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/cisco/libsrtp/archive/v${SRTP_VERSION}.tar.gz | tar -xz --strip-components=1 && \
./configure --prefix="${PREFIX}" --enable-shared --disable-static --enable-openssl --with-openssl-dir="${PREFIX}" && \
make shared_library && \
make install && \
rm -rf ${DIR}
## Build SRT
RUN \
DIR=/tmp/srt && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/Haivision/srt/archive/v${SRT_VERSION}.tar.gz | tar -xz --strip-components=1 && \
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}" ./configure \
--prefix="${PREFIX}" --enable-shared --disable-static && \
make && \
make install && \
rm -rf ${DIR} && \
rm -rf ${PREFIX}/bin
## Build OPUS
RUN \
DIR=/tmp/opus && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz | tar -xz --strip-components=1 && \
autoreconf -fiv && \
./configure --prefix="${PREFIX}" --enable-shared --disable-static && \
make && \
make install && \
rm -rf ${PREFIX}/share && \
rm -rf ${DIR}
## Build OpenH264
RUN \
DIR=${TEMP_PATH}/openh264 && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/cisco/openh264/archive/refs/tags/v${OPENH264_VERSION}.tar.gz | tar -xz --strip-components=1 && \
sed -i -e "s|PREFIX=/usr/local|PREFIX=${PREFIX}|" Makefile && \
make OS=linux ARCH=$(uname -s) && \
make install && \
rm -rf ${DIR}
## Build VPX
RUN \
DIR=/tmp/vpx && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://codeload.github.com/webmproject/libvpx/tar.gz/v${VPX_VERSION} | tar -xz --strip-components=1 && \
./configure --prefix="${PREFIX}" --enable-vp8 --enable-pic --enable-shared --disable-static --disable-vp9 --disable-debug --disable-examples --disable-docs --disable-install-bins && \
make && \
make install && \
rm -rf ${DIR}
## Build FDK-AAC
RUN \
DIR=/tmp/aac && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/mstorsjo/fdk-aac/archive/v${FDKAAC_VERSION}.tar.gz | tar -xz --strip-components=1 && \
autoreconf -fiv && \
./configure --prefix="${PREFIX}" --enable-shared --disable-static --datadir=/tmp/aac && \
make && \
make install && \
rm -rf ${DIR}
## Build FFMPEG
RUN \
DIR=/tmp/ffmpeg && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n${FFMPEG_VERSION}.tar.gz | tar -xz --strip-components=1 && \
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig:${PKG_CONFIG_PATH}" ./configure \
--prefix="${PREFIX}" \
--extra-cflags="-I${PREFIX}/include" \
--extra-ldflags="-L${PREFIX}/lib -Wl,-rpath,${PREFIX}/lib" \
--extra-libs=-ldl \
--enable-shared \
--disable-static \
--disable-debug \
--disable-doc \
--disable-programs \
--disable-avdevice --disable-dct --disable-dwt --disable-lsp --disable-lzo --disable-rdft --disable-faan --disable-pixelutils \
--enable-zlib --enable-libopus --enable-libvpx --enable-libfdk_aac --enable-libopenh264 \
--disable-everything \
--enable-encoder=libvpx_vp8,libvpx_vp9,libopus,libopenh264,libfdk_aac,mjpeg,png \
--enable-decoder=aac,aac_latm,aac_fixed,h264,hevc,opus,vp8 \
--enable-parser=aac,aac_latm,aac_fixed,h264,hevc,opus,vp8 \
--enable-network --enable-protocol=tcp --enable-protocol=udp --enable-protocol=rtp,file,rtmp --enable-demuxer=rtsp --enable-muxer=mp4,webm,mpegts,flv,mpjpeg \
--enable-filter=asetnsamples,aresample,aformat,channelmap,channelsplit,scale,transpose,fps,settb,asettb,format && \
make && \
make install && \
rm -rf ${PREFIX}/share && \
rm -rf ${DIR}
## Build jemalloc
RUN \
DIR=/tmp/jemalloc && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/jemalloc/jemalloc/releases/download/${JEMALLOC_VERSION}/jemalloc-${JEMALLOC_VERSION}.tar.bz2 | tar -jx --strip-components=1 && \
./configure --prefix="${PREFIX}" && \
make && \
make install_include install_lib && \
rm -rf ${DIR}
## Build pcre2
RUN \
DIR=/tmp/libpcre2 && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/PhilipHazel/pcre2/releases/download/pcre2-${PCRE2_VERSION}/pcre2-${PCRE2_VERSION}.tar.gz | tar -xz --strip-components=1 && \
./configure --prefix="${PREFIX}" \
--disable-static \
--enable-jit=auto && \
make && \
make install && \
rm -rf ${DIR} && \
rm -rf ${PREFIX}/bin
## Build OvenMediaEngine
RUN \
DIR=/tmp/ome && \
mkdir -p ${DIR} && \
cd ${DIR} && \
curl -sLf https://github.com/AirenSoft/OvenMediaEngine/archive/${OME_VERSION}.tar.gz | tar -xz --strip-components=1 && \
cd src && \
make release
## Make running environment
RUN \
DIR=/tmp/ome && \
cd ${DIR} && \
cd src && \
mkdir -p ${PREFIX}/bin/origin_conf && \
mkdir -p ${PREFIX}/bin/edge_conf && \
strip ./bin/RELEASE/OvenMediaEngine && \
cp ./bin/RELEASE/OvenMediaEngine ${PREFIX}/bin/ && \
cp ../misc/conf_examples/Origin.xml ${PREFIX}/bin/origin_conf/Server.xml && \
cp ../misc/conf_examples/Logger.xml ${PREFIX}/bin/origin_conf/Logger.xml && \
cp ../misc/conf_examples/Edge.xml ${PREFIX}/bin/edge_conf/Server.xml && \
cp ../misc/conf_examples/Logger.xml ${PREFIX}/bin/edge_conf/Logger.xml && \
rm -rf ${DIR}
FROM base AS release
MAINTAINER Jeheon Han <[email protected]>
WORKDIR /opt/ovenmediaengine/bin
EXPOSE 80/tcp 8080/tcp 8090/tcp 1935/tcp 3333/tcp 3334/tcp 4000-4005/udp 10000-10010/udp 9000/tcp
COPY --from=build /opt/ovenmediaengine /opt/ovenmediaengine
# Default run as Origin mode
CMD ["/opt/ovenmediaengine/bin/OvenMediaEngine", "-c", "origin_conf"]