From e3bef9b3e5600bd9726ba457bb2776e204aee88e Mon Sep 17 00:00:00 2001 From: bmamihai Date: Sat, 10 Dec 2022 02:38:09 +0200 Subject: [PATCH 1/7] New dockerfile --- Dockerfile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6eff224..f961eb1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,20 @@ -FROM ubuntu +FROM ubuntu:22.04 + +WORKDIR /app + RUN apt-get update && \ apt-get install -y build-essential pip net-tools iputils-ping iproute2 curl -RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - +RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - RUN apt-get install -y nodejs RUN npm install -g watchify +RUN npm install -g pm2 + +COPY server public .env app.js package.json /app/ + +RUN npm install EXPOSE 3000 -EXPOSE 2000-2020 -EXPOSE 10000-10100 \ No newline at end of file +EXPOSE 2000-2200 + +CMD [ "pm2", " start app.js --name video-server -e /app/mediasoup-error.log -o /app/mediasoup-output.log -l /app/mediasoup.log --log-date-format "YYYY-MM-DD HH:mm:ss" --merge-logs --cwd /app/ -i 1" ] \ No newline at end of file From 5b9bfeaa01f1fc390590dad50ecb8b92a51e9aa4 Mon Sep 17 00:00:00 2001 From: bmamihai Date: Sat, 10 Dec 2022 03:21:59 +0200 Subject: [PATCH 2/7] improve docker --- Dockerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f961eb1..be47331 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,11 +10,19 @@ RUN apt-get install -y nodejs RUN npm install -g watchify RUN npm install -g pm2 -COPY server public .env app.js package.json /app/ +RUN mkdir -p server/ssl +RUN mkdir -p public/ + +COPY .env app.js package.json /app/ +COPY server/ssl/* /app/server/ssl/ +COPY public/* /app/public/ RUN npm install -EXPOSE 3000 -EXPOSE 2000-2200 +EXPOSE 3000/tcp +EXPOSE 2000-2200/udp -CMD [ "pm2", " start app.js --name video-server -e /app/mediasoup-error.log -o /app/mediasoup-output.log -l /app/mediasoup.log --log-date-format "YYYY-MM-DD HH:mm:ss" --merge-logs --cwd /app/ -i 1" ] \ No newline at end of file +CMD pm2 start app.js --name video-server -e /app/mediasoup-error.log -o /app/mediasoup-output.log -l /app/mediasoup.log --log-date-format "YYYY-MM-DD HH:mm:ss" --merge-logs --cwd /app/ -i 1; pm2 status; pm2 logs + +#docker build -t linx-video . +# docker run -it -d --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video \ No newline at end of file From b2f9f5affad906d98caab0539d1915b6f1787697 Mon Sep 17 00:00:00 2001 From: bmamihai Date: Wed, 14 Dec 2022 00:48:14 +0200 Subject: [PATCH 3/7] remove pm2 and watchify --- Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index be47331..59212a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,8 +7,6 @@ RUN apt-get update && \ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - RUN apt-get install -y nodejs -RUN npm install -g watchify -RUN npm install -g pm2 RUN mkdir -p server/ssl RUN mkdir -p public/ @@ -22,7 +20,7 @@ RUN npm install EXPOSE 3000/tcp EXPOSE 2000-2200/udp -CMD pm2 start app.js --name video-server -e /app/mediasoup-error.log -o /app/mediasoup-output.log -l /app/mediasoup.log --log-date-format "YYYY-MM-DD HH:mm:ss" --merge-logs --cwd /app/ -i 1; pm2 status; pm2 logs +CMD node start app.js #docker build -t linx-video . # docker run -it -d --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video \ No newline at end of file From cdf02756d3743247ee08dd2b32930d806ad19a39 Mon Sep 17 00:00:00 2001 From: bmamihai Date: Wed, 14 Dec 2022 01:32:17 +0200 Subject: [PATCH 4/7] fix start --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 59212a0..4229901 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ RUN npm install EXPOSE 3000/tcp EXPOSE 2000-2200/udp -CMD node start app.js +CMD node app.js #docker build -t linx-video . # docker run -it -d --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video \ No newline at end of file From 3e31ba21bd1ff7a0be474422053e07ab18c15fe9 Mon Sep 17 00:00:00 2001 From: bmamihai Date: Thu, 15 Dec 2022 13:20:22 +0200 Subject: [PATCH 5/7] replace individual copy with copy all --- .dockerignore | 2 ++ Dockerfile | 7 +------ 2 files changed, 3 insertions(+), 6 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..be971a1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +doc \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4229901..a992199 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,12 +8,7 @@ RUN apt-get update && \ RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - RUN apt-get install -y nodejs -RUN mkdir -p server/ssl -RUN mkdir -p public/ - -COPY .env app.js package.json /app/ -COPY server/ssl/* /app/server/ssl/ -COPY public/* /app/public/ +COPY . /app/ RUN npm install From d5bc0cd1d3cd3406d83c093e66680d872b078f76 Mon Sep 17 00:00:00 2001 From: bmamihai Date: Thu, 5 Jan 2023 13:18:13 +0200 Subject: [PATCH 6/7] run under host network --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a992199..a653a05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,6 @@ EXPOSE 2000-2200/udp CMD node app.js #docker build -t linx-video . -# docker run -it -d --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video \ No newline at end of file +# docker run -it -d --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video +#Run under host network +# docker run -it -d --network host --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video \ No newline at end of file From 48eee903a5d0f72f5083c372a9f575777756d667 Mon Sep 17 00:00:00 2001 From: bmamihai Date: Thu, 5 Jan 2023 14:31:51 +0200 Subject: [PATCH 7/7] added command for limiting cpu/memory --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a653a05..c0089eb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,6 @@ CMD node app.js #docker build -t linx-video . # docker run -it -d --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video #Run under host network -# docker run -it -d --network host --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video \ No newline at end of file +# docker run -it -d --network host --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video +#https://docs.docker.com/config/containers/resource_constraints/ +#docker run -it -d --network host --cpus="0.25" --memory="512m" --restart always -p 3000:3000/tcp -p 2000-2200:2000-2200/udp linx-video \ No newline at end of file