This commit is contained in:
virus
2025-01-29 10:14:29 +01:00
parent 69d8ca94e7
commit 2528faf7ed
4 changed files with 22 additions and 14 deletions
+6 -5
View File
@@ -1,11 +1,12 @@
FROM node:14-alpine
RUN npm install --silent socket.io
RUN npm install --silent express
FROM node:22-alpine
RUN mkdir /srv/public/
WORKDIR /srv/
RUN npm install socket.io
RUN npm install express
COPY ./app.js /srv/app.js
COPY ./public/index.html /srv/public/index.html
+12 -1
View File
@@ -1,11 +1,22 @@
const PORT = process.env.PORT || 8080;
const PREFIX = process.env.PREFIX || '/ws';
const DEV = process.env.DEV || false;
console.log('Socket.io listen on: http://localhost:' + PORT + '' + PREFIX + '/socket.io');
console.log('Publisher listen on: http://localhost:' + PORT + '' + PREFIX + '/pub/$roomID');
if (DEV !== false) {
console.log('System is on DEV mode');
}
const app = require('express')();
const server = require('http').createServer(app);
const io = require('socket.io')(server, {path: PREFIX + '/socket.io'});
var io;
if (DEV !== false) {
io = require('socket.io')(server, {path: PREFIX + '/socket.io', cors: {origin: '*',}});
} else {
io = require('socket.io')(server, {path: PREFIX + '/socket.io'});
}
const bodyParser = require('body-parser');
+3 -8
View File
@@ -1,26 +1,21 @@
version: '3'
services:
push:
image: registry.docker.tlfactory.pl/apps/push-stream-channels:0.1
image: docker.git.tlfactory.pl/apps/push-stream-channels:0.4
build:
context: .
dockerfile: ./Dockerfile
restart: on-failure
environment:
- PORT=8080
- DEV=1
ports:
- 80:8080
- 8201:8080
volumes:
- ./app.js:/srv/app.js
- ./public:/srv/public
networks:
- backend
php:
image: registry.docker.tlfactory.pl/apps/php-apache:7.4.20
networks:
- backend
volumes:
- ./public/:/var/www/html
networks:
backend:
+1
View File
@@ -1,4 +1,5 @@
<script src="/ws/socket.io/socket.io.js"></script>
<!-- <script src="/ws/socket.io/socket.io.min.js"></script>-->
<script>
const socket = io("http://localhost", {
path: '/ws/socket.io',