Trying to modify run.sh so it waits for the Xvfb server to start accepting connections.
This commit is contained in:
parent
41046c2837
commit
15dc14f5b6
2 changed files with 19 additions and 2 deletions
|
@ -15,6 +15,7 @@ RUN apt-get -qq update \
|
||||||
libprotobuf-dev \
|
libprotobuf-dev \
|
||||||
libxxf86vm-dev \
|
libxxf86vm-dev \
|
||||||
xvfb \
|
xvfb \
|
||||||
|
netcat \
|
||||||
&& echo "deb https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodejs.list \
|
&& echo "deb https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodejs.list \
|
||||||
&& echo "deb-src https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodejs.list \
|
&& echo "deb-src https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodejs.list \
|
||||||
&& apt-get -qq update \
|
&& apt-get -qq update \
|
||||||
|
|
20
run.sh
20
run.sh
|
@ -1,9 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
|
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
|
||||||
|
|
||||||
timeout 15 bash -c 'until echo > /dev/tcp/localhost/99; do sleep 0.5; done'
|
let p=80
|
||||||
|
while [ ${p} -lt 3000 ]
|
||||||
|
do
|
||||||
|
if nc -z localhost ${p}; then
|
||||||
|
let p+=1
|
||||||
|
else
|
||||||
|
let port=p
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo The port is ${port}
|
||||||
|
|
||||||
export DISPLAY=:99.0
|
if ${port}; then
|
||||||
|
timeout 15 bash -c "until echo > /dev/tcp/localhost/${port}; do sleep 0.5; done"
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DISPLAY=:${port}.0
|
||||||
|
|
||||||
cd /data
|
cd /data
|
||||||
node /usr/src/app/ -p 80 "$@"
|
node /usr/src/app/ -p 80 "$@"
|
||||||
|
|
Loading…
Reference in a new issue