-
Notifications
You must be signed in to change notification settings - Fork 8
/
tryWebSocketServer.sh
executable file
·53 lines (38 loc) · 1.54 KB
/
tryWebSocketServer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash -x
SCRIPT_FILE=/home/developer/data/examples/ws-echo-server.js
HOST_PORT=8080
SERVER_PORT=8080
TIMEOUT_SEC=120
###################################################
#### ---- Change this only if want to use your own
###################################################
ORGANIZATION=openkbs
###################################################
#### ---- Container package information ----
###################################################
DOCKER_IMAGE_REPO=`echo $(basename $PWD)|tr '[:upper:]' '[:lower:]'|tr "/: " "_" `
imageTag=${1:-"${ORGANIZATION}/${DOCKER_IMAGE_REPO}"}
###################################################
#### ---- Mostly, you don't need change below ----
###################################################
instanceName=some-jdk-mvn-py3
function cleanup() {
if [ ! "`docker ps -a|grep ${instanceName}`" == "" ]; then
docker rm -f ${instanceName}
fi
}
cleanup
#if [ ! -s ./data ]; then
# mkdir -p ./data
#fi
echo "---> Testing the mini-server by the ${SCRIPT_FILE} script:"
echo "---> run the ws-client.js program:"
echo ".... Open an other XTERM console with the current same directory:"
echo ".... then run the command below to see the Client/Server messages"
echo " node examples/ws-client.js"
echo
echo ".... Starting websocket echo server ....."
echo
docker run --rm --name ${instanceName} -v $PWD/examples:/data -p ${HOST_PORT}:${SERVER_PORT} --workdir /data ${imageTag} node /data/$(basename ${SCRIPT_FILE})
#./run.sh node ${SCRIPT_FILE}
#./run.sh node /home/developer/data/examples/ws-echo-server.js