forked from ant-media/Ant-Media-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
101 lines (90 loc) · 4.71 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
#FROM ubuntu:lunar-20230420
#FROM travisci/ci-ubuntu-1804:packer-1681429211-723c3e55
FROM ubuntu:20.04
LABEL authors="Ehsan Mozaffari"
ARG AMS_DOMAIN=""
ARG AMS_UTILITIES_REPO=https://github.com/ant-media/utilities.git
ARG AMS_PARENT_REPO=https://github.com/ant-media/ant-media-server-parent.git
ARG AMS_STREAM_REPO=https://github.com/ant-media/StreamApp.git
ARG AMS_MGMT_CONSOLE_ANGULAR_REPO=https://github.com/ant-media/ManagementConsole_AngularApp.git
ARG AMS_INSTALLER_REPO=https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh
COPY . /app
WORKDIR /app
RUN apt update --fix-missing \
&& apt install -y \
curl git maven npm libcap2 wget net-tools \
openjdk-11-jdk iproute2 cron logrotate \
unzip libx11-dev ca-certificates p11-kit \
--no-install-recommends \
&& apt purge mongodb* -qq \
&& apt autoremove -qq \
&& chmod -R 777 /tmp \
&& rm -rf /var/lib/mongodb \
&& wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - \
&& echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list \
&& sed -e 's/^bind.*/bind 127.0.0.1/' /etc/redis/redis.conf > redis.conf \
&& mv redis.conf /etc/redis \
&& service redis-server start \
&& apt update -qq \
&& apt install mongodb-org ffmpeg wondershaper -y -qq \
&& mongod --dbpath /var/lib/mongodb &>/dev/null & \
&& git clone --depth=1 ${AMS_UTILITIES_REPO} /usr/local/onvif \
&& git clone --depth=1 ${AMS_PARENT_REPO} \
&& cd ant-media-server-parent \
&& mvn clean install -DskipTests -Dmaven.javadoc.skip=true -Dgpg.skip=true --quiet \
&& cd .. \
&& mvn clean install -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -Dgpg.skip=true --quiet \
&& apt -y install libx11-dev unzip wget net-tools openjdk-11-jdk ca-certificates p11-kit --no-install-recommends \
&& git clone --depth=1 ${AMS_STREAM_REPO} \
&& cd StreamApp \
&& mvn clean install -DskipTests -Dmaven.javadoc.skip=true -Dgpg.skip=true -B -V --quiet \
&& cd .. \
&& npm install -g @angular/cli@10.0.5 \
&& git clone --depth=1 ${AMS_MGMT_CONSOLE_ANGULAR_REPO} \
&& cd ManagementConsole_AngularApp \
&& npm install \
&& export NODE_OPTIONS=--openssl-legacy-provider \
&& ng build --prod \
&& cp -a ./dist/. ../src/main/server/webapps/root/ \
&& cd .. \
&& wget -O ~/.m2/repository/org/bytedeco/ffmpeg/5.1.2-1.5.8/ffmpeg-5.1.2-1.5.8-linux-x86_64.jar https://storage.sbg.cloud.ovh.net/v1/AUTH_8cb28f9bc6ee43f0a3a1825efbb4311e/test-storage/ffmpeg-5.1.2-1.5.8-linux-x86_64.jar \
&& wget -O ~/.m2/repository/org/bytedeco/ffmpeg/5.1.2-1.5.8/ffmpeg-5.1.2-1.5.8-linux-arm64.jar https://storage.sbg.cloud.ovh.net/v1/AUTH_8cb28f9bc6ee43f0a3a1825efbb4311e/test-storage/ffmpeg-5.1.2-1.5.8-linux-arm64.jar \
&& mvn clean package -U -P assemble -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -DskipTests=true --quiet \
&& wget ${AMS_INSTALLER_REPO} -O target/install_ant-media-server.sh \
&& chmod 755 target/install_ant-media-server.sh \
&& cd target \
&& ./install_ant-media-server.sh ant-media-server-community*.zip -s false \
&& cd .. \
&& echo "Waiting a little to make sure server is started " \
&& sleep 20 \
&& cat /usr/local/antmedia/log/antmedia-error.log \
&& cat /usr/local/antmedia/log/ant-media-server.log \
&& cp src/test/resources/preset-red5-web.properties /usr/local/antmedia/webapps/LiveApp/WEB-INF/red5-web.properties \
&& cp src/test/resources/preset-red5-web.db /usr/local/antmedia/liveapp.db \
&& sed -i 's^server.cpu_limit=.*^server.cpu_limit=100^' /usr/local/antmedia/conf/red5.properties \
&& apt clean \
&& apt autoclean \
&& apt autoremove \
&& rm -rfv /var/lib/apt/lists/* /temp/*
RUN chmod 775 /usr/local/antmedia/enable_ssl.sh
RUN if [ "$AMS_DOMAIN" = "" ] ; then \
echo "Skipping the ssl installation! AMS_DOMAIN=[your-domain] ARG is not defined in docker build!" ; \
else \
./usr/local/antmedia/enable_ssl.sh -d ${AMS_DOMAIN} ; \
fi
RUN chmod 775 /usr/local/antmedia/start.sh
WORKDIR /usr/local/antmedia
# Options: add them in the docker compose command section
# -g: Use global(Public) IP in network communication.
# -s: Use Public IP as server name.
# -r: Replace candidate address with server name.
# -m: Server mode.
# -h: MongoDB or Redist host.
# -u: MongoDB username: Deprecated.
# -p: MongoDB password: Deprecated.
# -l: Licence Key
# -a: TURN/STUN Server URL for the server side.
# -n: TURN Server Usermame
# -w: TURN Server Password
ENTRYPOINT ["/bin/sh","-c","/usr/local/antmedia/start.sh"]
CMD ["&& echo Add antmedia/start.sh argument in docker command section!"]