!2 新的dockerfile

Merge pull request !2 from hotcoffie/wvp-28181-2.0
This commit is contained in:
panll 2021-11-09 01:55:13 +00:00 committed by Gitee
commit fe043f37e7
5 changed files with 141 additions and 12 deletions

47
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,47 @@
version: '3'
services:
redis:
image: redis
restart: always
volumes:
- ./redis/redis.conf:/etc/redis/redis_default.conf
- ./redis/data/:/data
environment:
TZ: "Asia/Shanghai"
command: redis-server /etc/redis/redis_default.conf --appendonly yes
wvp:
build:
context: ./wvp
args:
gitUrl: "https://gitee.com/xieyu1989"
zlmGitUrl: "https://gitee.com/xia-chu/ZLMediaKit"
restart: always
ports:
- "5060:5060"
- "5060:5060/udp"
- "18080:18080"
- "80:80"
- "10000:10000/tcp"
- "10000:10000/udp"
- "30000-30500:30000-30500/tcp"
- "30000-30500:30000-30500/udp"
volumes:
- ./video:/opt/media/www/record/
- ./logs/wvp:/opt/wvp/logs/
- ./logs/assist:/opt/assist/logs/
- ./logs/media:/opt/media/log/
environment:
TZ: "Asia/Shanghai"
# [必须修改] 本机的IP
WVP_HOST: 172.18.0.61
WVP_PWD: aseqw_+hiy123
WVP_DOMAIN: 6101130049
WVP_ID: 61011300490000000001
REDIS_HOST: redis
REDIS_PORT: 6379
REDIS_DB: 6
REDIS_PWD: root
ASSIST_CONFIG:
WVP_CONFIG:
depends_on:
- redis

2
docker/redis/redis.conf Normal file
View File

@ -0,0 +1,2 @@
requirepass root
bind 0.0.0.0

78
docker/wvp/Dockerfile Normal file
View File

@ -0,0 +1,78 @@
FROM ubuntu:20.04 AS build
ARG gitUrl="https://gitee.com/18010473990"
ARG zlmGitUrl="https://gitee.com/xia-chu/ZLMediaKit"
RUN export DEBIAN_FRONTEND=noninteractive &&\
apt-get update && \
apt-get install -y --no-install-recommends openjdk-11-jre git maven nodejs npm build-essential \
cmake ca-certificates openssl ffmpeg
RUN cd /home && \
git clone "https://gitee.com/18010473990/maven.git" && \
cp maven/settings.xml /usr/share/maven/conf/ && \
git clone "${gitUrl}/wvp-GB28181.git" && \
git clone "${gitUrl}/wvp-pro-assist.git" && \
git clone --depth=1 "${zlmGitUrl}" && \
mkdir -p /opt/wvp/config /opt/assist/config /opt/media/www/record
RUN cd /home/wvp-GB28181/web_src && \
npm install && \
npm run build
RUN cd /home/wvp-GB28181 && \
mvn clean package -Dmaven.test.skip=true && \
cp /home/wvp-GB28181/target/*.jar /opt/wvp/ && \
cp /home/wvp-GB28181/src/main/resources/application-dev.yml /opt/wvp/config/application.yml
RUN cd /home/wvp-pro-assist && \
mvn clean package -Dmaven.test.skip=true && \
cp /home/wvp-pro-assist/target/*.jar /opt/assist/ && \
cp /home/wvp-pro-assist/src/main/resources/application-dev.yml /opt/assist/config/application.yml
RUN cd /home/ZLMediaKit && \
git submodule update --init --recursive && \
mkdir -p build release/linux/Release/ &&\
cd build && \
cmake -DCMAKE_BUILD_TYPE=Release .. && \
make -j4 && \
rm -rf ../release/linux/Release/config.ini && \
cp -r ../release/linux/Release/* /opt/media
RUN cd /opt/wvp && \
echo '#!/bin/bash' > run.sh && \
echo 'echo ${WVP_IP}' >> run.sh && \
echo 'echo ${WVP_CONFIG}' >> run.sh && \
echo 'cd /opt/assist' >> run.sh && \
echo 'nohup java -jar *.jar --spring.config.location=/opt/assist/config/application.yml --userSettings.record=/opt/media/www/record/ --media.record-assist-port=18081 ${ASSIST_CONFIG} &' >> run.sh && \
echo 'nohup /opt/media/MediaServer -d -m 3 &' >> run.sh && \
echo 'cd /opt/wvp' >> run.sh && \
echo 'java -jar *.jar --spring.config.location=/opt/wvp/config/application.yml --media.record-assist-port=18081 ${WVP_CONFIG}' >> run.sh && \
chmod +x run.sh
FROM ubuntu:20.04
EXPOSE 18080/tcp
EXPOSE 5060/tcp
EXPOSE 5060/udp
EXPOSE 6379/tcp
EXPOSE 18081/tcp
EXPOSE 80/tcp
EXPOSE 1935/tcp
EXPOSE 554/tcp
EXPOSE 554/udp
EXPOSE 30000-30500/tcp
EXPOSE 30000-30500/udp
ENV LC_ALL zh_CN.UTF-8
RUN export DEBIAN_FRONTEND=noninteractive &&\
apt-get update && \
apt-get install -y --no-install-recommends openjdk-11-jre ca-certificates ffmpeg language-pack-zh-hans && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*dic
COPY --from=build /opt /opt
WORKDIR /opt/wvp
CMD ["sh", "run.sh"]

View File

@ -2,13 +2,13 @@ spring:
# REDIS数据库配置
redis:
# [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1
host: 127.0.0.1
host: ${REDIS_HOST:127.0.0.1}
# [必须修改] 端口号
port: 6379
port: ${REDIS_PORT:6379}
# [可选] 数据库 DB
database: 6
database: ${REDIS_DB:6}
# [可选] 访问密码,若你的redis服务器没有设置密码就不需要用密码去连接
password:
password: ${REDIS_PWD}
# [可选] 超时时间
timeout: 10000
# [可选] jdbc数据库配置, 项目使用sqlite作为数据库一般不需要配置
@ -36,18 +36,18 @@ server:
# 作为28181服务器的配置
sip:
# [必须修改] 本机的IP
ip: 192.168.0.100
ip: ${WVP_HOST}
# [可选] 28181服务监听的端口
port: 5060
# 根据国标6.1.2中规定domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码由省级、市级、区级、基层编号组成参照GB/T 2260-2007
# 后两位为行业编码定义参照附录D.3
# 3701020049标识山东济南历下区 信息行业接入
# [可选]
domain: 4401020049
domain: ${WVP_DOMAIN:4401020049}
# [可选]
id: 44010200492000000001
id: ${WVP_ID:44010200492000000001}
# [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验
password: admin123
password: ${WVP_PWD:admin123}
#zlm 默认服务器配置
media:
@ -66,8 +66,9 @@ media:
# [可选] 国标级联在此范围内选择端口发送媒体流,
send-port-range: 30000,30500 # 端口范围
# 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载 0 表示不使用
record-assist-port: 0
record-assist-port: 18081
sdp-ip: ${WVP_HOST}
stream-ip: ${WVP_HOST}
# [可选] 日志配置, 一般不需要改
logging:
file:
@ -84,6 +85,7 @@ logging:
user-settings:
# 推流直播是否录制
record-push-live: true
auto-apply-play: false
# 在线文档: swagger-ui生产环境建议关闭
swagger-ui:
@ -93,4 +95,4 @@ swagger-ui:
version:
version: "@project.version@"
description: "@project.description@"
artifact-id: "@project.artifactId@"
artifact-id: "@project.artifactId@"

View File

@ -1,3 +1,3 @@
spring:
profiles:
active: local
active: dev