Here’s what I have in my Dockerfile
FROM ubuntu:20.04
# gcc g++ make
RUN \
apt-get update && \
apt-get install -y build-essential
# Python 3.8 and pip
RUN \
DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata && \
apt install -y software-properties-common && \
add-apt-repository ppa:deadsnakes/ppa && \
apt update && \
apt install -y python3.8 python3-pip
# NodeJS 14.X and npm
RUN \
apt install -y curl dirmngr apt-transport-https lsb-release ca-certificates && \
curl -sL https://deb.nodesource.com/setup_14.x | bash - && \
apt-get install -y nodejs
WORKDIR /app
COPY package*.json ./
RUN npm i
COPY ./build .
EXPOSE 8083
EXPOSE 30000-30100/tcp
EXPOSE 30000-30100/udp
CMD [ "node", "index.js" ]
And my config file:
import os from "os";
const ifaces = os.networkInterfaces();
const getLocalIp = () => {
let localIp = "127.0.0.1";
Object.keys(ifaces).forEach((ifname) => {
for (const iface of ifaces[ifname] ?? []) {
// Ignore IPv6 and 127.0.0.1
if (iface.family !== "IPv4" || iface.internal !== false) {
continue;
}
// Set the local ip to the first IPv4 address found and exit the loop
localIp = iface.address;
return;
}
});
return localIp;
};
const localIp = getLocalIp();
{
// Worker settings
numWorkers: Object.keys(os.cpus()).length,
worker: {
rtcMinPort: 30000,
rtcMaxPort: 30100,
logLevel: "warn",
logTags: [
"info",
"ice",
"dtls",
"rtp",
"srtp",
"rtcp",
// 'rtx',
// 'bwe',
// 'score',
// 'simulcast',
// 'svc'
],
},
// Router settings
router: {
mediaCodecs: [
{
kind: "audio",
mimeType: "audio/opus",
clockRate: 48000,
channels: 2,
},
{
kind: "video",
mimeType: "video/VP8",
clockRate: 90000,
parameters: {
"x-google-start-bitrate": 1000,
},
},
{
kind: "video",
mimeType: "video/VP9",
clockRate: 90000,
parameters: {
"profile-id": 2,
"x-google-start-bitrate": 1000,
},
},
{
kind: "video",
mimeType: "video/h264",
clockRate: 90000,
parameters: {
"packetization-mode": 1,
"profile-level-id": "4d0032",
"level-asymmetry-allowed": 1,
"x-google-start-bitrate": 1000,
},
},
{
kind: "video",
mimeType: "video/h264",
clockRate: 90000,
parameters: {
"packetization-mode": 1,
"profile-level-id": "42e01f",
"level-asymmetry-allowed": 1,
"x-google-start-bitrate": 1000,
},
},
],
},
// WebRtcTransport settings
webRtcTransport: {
listenIps: [
{
ip: "0.0.0.0",
announcedIp: localIp,
},
],
maxIncomingBitrate: 1500000,
initialAvailableOutgoingBitrate: 1000000,
},
},