From d0c640f73ba0ee889a7bbb0308240a5ff6a61f50 Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Wed, 18 Sep 2024 19:38:09 +0200 Subject: [PATCH] fix: fixed "Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory" Refs: #60 --- Dockerfile | 7 +++++-- entrypoint.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 entrypoint.sh diff --git a/Dockerfile b/Dockerfile index 8fc8567..8625472 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ LABEL maintainer="SBB Polarion Team " ARG APP_IMAGE_VERSION RUN apt-get update && \ - apt-get --yes --no-install-recommends install chromium fonts-dejavu fonts-liberation libpango-1.0-0 libpangoft2-1.0-0 python3-brotli python3-cffi && \ + apt-get --yes --no-install-recommends install chromium dbus fonts-dejavu fonts-liberation libpango-1.0-0 libpangoft2-1.0-0 python3-brotli python3-cffi vim && \ apt-get clean autoclean && \ apt-get --yes autoremove && \ rm -rf /var/lib/apt/lists/* @@ -21,4 +21,7 @@ RUN pip install --no-cache-dir -r ${WORKING_DIR}/requirements.txt COPY ./app/*.py ${WORKING_DIR}/app/ -ENTRYPOINT [ "python", "app/WeasyprintServiceApplication.py" ] +COPY entrypoint.sh ${WORKING_DIR}/entrypoint.sh +RUN chmod +x ${WORKING_DIR}/entrypoint.sh + +ENTRYPOINT [ "./entrypoint.sh" ] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..a803896 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +if ! pgrep -x 'dbus-daemon' > /dev/null; then + if [ -f /run/dbus/pid ]; then + rm /run/dbus/pid + fi + dbus-daemon --system --fork; +fi + +python app/WeasyprintServiceApplication.py & + +wait -n + +exit $? \ No newline at end of file