From ad84480c104e88e686ca8067de4d5f515bf49354 Mon Sep 17 00:00:00 2001 From: Mario1159 Date: Mon, 25 Sep 2023 19:49:37 -0300 Subject: [PATCH] Fix race condition --- base/web.Dockerfile | 1 + scripts/startserver | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/base/web.Dockerfile b/base/web.Dockerfile index a6974b5..c812d5a 100644 --- a/base/web.Dockerfile +++ b/base/web.Dockerfile @@ -8,6 +8,7 @@ RUN sudo pacman -Syuq --noconfirm # Install KASM VNC server RUN paru -S --noconfirm kasmvncserver-bin +ENV DISPLAY=:1 # KASM requires the hostname binary to start RUN sudo pacman -S --noconfirm inetutils diff --git a/scripts/startserver b/scripts/startserver index 5932175..4b4380a 100644 --- a/scripts/startserver +++ b/scripts/startserver @@ -2,12 +2,18 @@ cd /home/designer # Run VNC server -export DISPLAY=:1 eval $(vncserver -dry-run) & echo -e "password\npassword\n" | vncpasswd -u designer -w -r # Wait for VNC server to start -sleep 1 +sleep 2 +while ! xset q &>/dev/null; +do +echo "XServer not responsive, retrying..." +sleep 2 +done + +echo "XServer has been found, running desktop environment" # Run desktop environment (XFCE) xfce4-session --display=$DISPLAY