forked from AirenSoft/OvenMediaEngine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
70 lines (55 loc) · 2.36 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
FROM ubuntu:20.04 AS base
## Install libraries by package
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y tzdata sudo curl
FROM base AS build
WORKDIR /tmp
ARG OME_VERSION=master
ARG STRIP=TRUE
ARG GPU=FALSE
ARG NVIDIA_DRIVER=0
ENV PREFIX=/opt/ovenmediaengine
ENV TEMP_DIR=/tmp/ome
## Download OvenMediaEngine
RUN \
mkdir -p ${TEMP_DIR} && \
cd ${TEMP_DIR} && \
curl -sLf https://github.com/AirenSoft/OvenMediaEngine/archive/${OME_VERSION}.tar.gz | tar -xz --strip-components=1
## Install dependencies
RUN \
if [ "$GPU" = "TRUE" ] ; then \
${TEMP_DIR}/misc/install_nvidia_driver.sh --enable_docker --nvidia_driver ${NVIDIA_DRIVER} ; \
${TEMP_DIR}/misc/prerequisites.sh --enable-nvc ; \
else \
${TEMP_DIR}/misc/prerequisites.sh ; \
fi
## Build OvenMediaEngine
RUN \
cd ${TEMP_DIR}/src && \
make release -j$(nproc)
RUN \
if [ "$STRIP" = "TRUE" ] ; then strip ${TEMP_DIR}/src/bin/RELEASE/OvenMediaEngine ; fi
## Make running environment
RUN \
cd ${TEMP_DIR}/src && \
mkdir -p ${PREFIX}/bin/origin_conf && \
mkdir -p ${PREFIX}/bin/edge_conf && \
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 && \
cp ../misc/install_nvidia_driver.sh ${PREFIX}/bin/install_nvidia_driver.sh && \
rm -rf ${TEMP_DIR}
FROM base AS release
ARG GPU=FALSE
ARG NVIDIA_DRIVER=0
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
# If the GPU is enabled, reinstall the NVIDIA driver into the release image
RUN \
if [ "$GPU" = "TRUE" ] ; then \
/opt/ovenmediaengine/bin/install_nvidia_driver.sh --enable_docker --nvidia_driver ${NVIDIA_DRIVER} ; fi
# Default run as Origin mode
CMD ["/opt/ovenmediaengine/bin/OvenMediaEngine", "-c", "origin_conf"]