Skip to content

Instantly share code, notes, and snippets.

@linj121
Created May 22, 2024 22:09
Show Gist options
  • Save linj121/038dac7746423dbfd751ab776e84bb50 to your computer and use it in GitHub Desktop.
Save linj121/038dac7746423dbfd751ab776e84bb50 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Set default values for configuration files
CONFIG_DIR=${CONFIG_DIR:-/etc/zlmediakit}
CONFIG_FILE=${CONFIG_FILE:-$CONFIG_DIR/config.ini}
SSL_CERT_FILE=${SSL_CERT_FILE:-$CONFIG_DIR/default.pem}
if [ ! -d "$CONFIG_DIR" ]; then
echo "Configuration directory $CONFIG_DIR does not exist. Please create it and add your config.ini and default.pem files."
exit 1
fi
if [ ! -f "$CONFIG_FILE" ]; then
echo "Configuration file $CONFIG_FILE does not exist. Please add your config.ini file."
exit 1
fi
if [ ! -f "$SSL_CERT_FILE" ]; then
echo "SSL certificate file $SSL_CERT_FILE does not exist. Please add your default.pem file."
exit 1
fi
# 1935: rtmp
# 80: http, 443: https
# 554: rtsp
# others: webrtc, ...
sudo docker run -id -p 1935:1935 \
-p 80:80 \
-p 443:443 \
-p 8554:554 \
-p 10000:10000 \
-p 10000:10000/udp \
-p 8000:8000/udp \
-p 9000:9000/udp \
-v $CONFIG_FILE:/opt/media/conf/config.ini \
-v $SSL_CERT_FILE:/opt/media/bin/default.pem \
--restart always \
zlmediakit/zlmediakit:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment