entrypoint.sh 932 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. set -e
  3. VNC_PASSWORD="${VNC_PASSWORD:-changeme}"
  4. RESOLUTION="${RESOLUTION:-1280x800}"
  5. if [ "$VNC_PASSWORD" = "changeme" ]; then
  6. echo "WARNING: using default VNC password 'changeme'. Set VNC_PASSWORD in your .env file." >&2
  7. fi
  8. # This tigervnc build ships no vncpasswd tool; it authenticates VNC's "Plain"
  9. # security type against the Unix account password via PAM instead.
  10. echo "ubuntu:${VNC_PASSWORD}" | sudo chpasswd
  11. mkdir -p "$HOME/.vnc"
  12. cp /opt/vnc/xstartup "$HOME/.vnc/xstartup"
  13. chmod +x "$HOME/.vnc/xstartup"
  14. # Clean up any stale lock/pid files from a previous run of this volume
  15. vncserver -kill :1 >/dev/null 2>&1 || true
  16. rm -f /tmp/.X1-lock /tmp/.X11-unix/X1
  17. vncserver :1 -geometry "$RESOLUTION" -depth 24 -localhost no \
  18. -SecurityTypes Plain -PlainUsers ubuntu
  19. websockify --web=/usr/share/novnc/ 6901 localhost:5901 &
  20. LOGFILE="$HOME/.vnc/$(hostname):1.log"
  21. touch "$LOGFILE"
  22. exec tail -f "$LOGFILE"