From ea7a79e50a753ecf8aa4f27e454918b287990046 Mon Sep 17 00:00:00 2001 From: Constantin Piber <59023762+cpiber@users.noreply.github.com> Date: Sun, 6 Jul 2025 18:48:38 +0200 Subject: [PATCH] Switch to `xvfb-run` instead of manually calling `Xvfb` (#141) This should ensure it always finds a display number. It also makes sure to properly kill `Xvfb`, which we did not do before. --- Dockerfile | 3 ++- scripts/startup_script.sh | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f710fc8..3cc2512 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,7 +49,7 @@ RUN apt-get update && \ # install unzip to unzip the server-reference.conf from the jar RUN apt-get update && \ - apt-get -y install -y unzip && \ + apt-get -y install -y unzip tini && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* @@ -100,6 +100,7 @@ RUN if command -v Xvfb; then \ USER suwayomi EXPOSE 4567 +ENTRYPOINT ["tini", "--"] CMD ["/home/suwayomi/startup_script.sh"] # vim: set ft=dockerfile: diff --git a/scripts/startup_script.sh b/scripts/startup_script.sh index 18f2811..df8c4c4 100755 --- a/scripts/startup_script.sh +++ b/scripts/startup_script.sh @@ -97,10 +97,7 @@ sed -i -r "s/server.opdsShowOnlyDownloadedChapters = ([0-9]+|[a-zA-Z]+)( #)?/ser sed -i -r "s/server.opdsChapterSortOrder = \"(.*?)\"( #)?/server.opdsChapterSortOrder = \"${OPDS_CHAPTER_SORT_ORDER:-\1}\" #/" /home/suwayomi/.local/share/Tachidesk/server.conf if command -v Xvfb >/dev/null; then - rm -f /tmp/.X0-lock - Xvfb :0 -screen 0 800x680x24 -nolisten tcp >/dev/null 2>&1 & - export DISPLAY=:0 - + command="xvfb-run --auto-servernum java" if [ -d /opt/kcef/jcef ]; then # if we have KCEF downloaded in the container, attempt to link it into the data directory where Suwayomi expects it if [ ! -d /home/suwayomi/.local/share/Tachidesk/bin ]; then @@ -113,7 +110,7 @@ if command -v Xvfb >/dev/null; then if [ -d /home/suwayomi/.local/share/Tachidesk/bin/kcef ] || [ -L /home/suwayomi/.local/share/Tachidesk/bin/kcef ]; then # make sure all files are always executable. KCEF (and our downloader) ensure this on creation, but if the flag is lost # at some point, CEF will die - chmod -R a+x /home/suwayomi/.local/share/Tachidesk/bin/kcef || true + chmod -R a+x /home/suwayomi/.local/share/Tachidesk/bin/kcef 2>/dev/null || true fi export LD_PRELOAD=/home/suwayomi/.local/share/Tachidesk/bin/kcef/libcef.so else @@ -121,6 +118,7 @@ else fi if [ -f /opt/catch_abort.so ]; then export LD_PRELOAD="/opt/catch_abort.so $LD_PRELOAD" + command="java" fi echo "LD_PRELOAD=$LD_PRELOAD" -exec java -Duser.home=/home/suwayomi -jar "/home/suwayomi/startup/tachidesk_latest.jar"; +exec $command -Duser.home=/home/suwayomi -jar "/home/suwayomi/startup/tachidesk_latest.jar";