Docker setup
This commit is contained in:
1 parent
65d1092898
commit
67ecf3b8d7
7 files changed
+75
-7
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
.env*
|
||||||
|
.git*
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
VNC_PORT=5900
|
||||||
@@ -26,3 +26,7 @@ settings.json
|
|||||||
/*.AppImage.zsync
|
/*.AppImage.zsync
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.app
|
*.app
|
||||||
|
# Docker
|
||||||
|
/volumes/
|
||||||
|
!/volumes/.gitkeep
|
||||||
|
/.env
|
||||||
+45
@@ -0,0 +1,45 @@
|
|||||||
|
# Python 3.14 base & pip installation
|
||||||
|
FROM python:3.14 AS base
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libgirepository1.0-dev \
|
||||||
|
libcairo2-dev \
|
||||||
|
pkg-config \
|
||||||
|
python3-dev \
|
||||||
|
gtk+3.0 \
|
||||||
|
dbus-x11 \
|
||||||
|
x11vnc \
|
||||||
|
xvfb \
|
||||||
|
fluxbox \
|
||||||
|
net-tools \
|
||||||
|
libappindicator3-dev \
|
||||||
|
libayatana-appindicator3-dev \
|
||||||
|
x11-utils
|
||||||
|
|
||||||
|
COPY requirements.txt ./
|
||||||
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
# Create the final image
|
||||||
|
FROM base
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the rest of the project files
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Start Xvfb, Fluxbox, and x11vnc, then run the application
|
||||||
|
CMD rm -f /tmp/.X1-lock && \
|
||||||
|
Xvfb :1 -screen 0 1280x720x16 & \
|
||||||
|
fluxbox & \
|
||||||
|
# Wait for the X server to be up
|
||||||
|
while ! xdpyinfo -display :1 > /dev/null 2>&1; do \
|
||||||
|
echo "Waiting for X server to be available..."; \
|
||||||
|
sleep 1; \
|
||||||
|
done && \
|
||||||
|
echo "X server is running" || (echo "X server failed to start, exiting..." && exit 1); \
|
||||||
|
# Start x11vnc with additional logging
|
||||||
|
x11vnc -display :1 -nopw -listen 0.0.0.0 -forever -xkb -no6 -noxdamage -o /var/log/x11vnc.log & \
|
||||||
|
# Explicitly set the DISPLAY variable for the Python application
|
||||||
|
export DISPLAY=:1 && python main.py 2>&1 | tee /var/log/main.log
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: ./
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
environment:
|
||||||
|
- TZ=Europe/Berlin
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:${VNC_PORT:-5900}:5900"
|
||||||
|
volumes:
|
||||||
|
- ./volumes/data:/app/data
|
||||||
+7
-6
@@ -92,6 +92,7 @@ else:
|
|||||||
if SELF_PATH.stem == "pyinstaller" or SELF_PATH.name == "gui.py":
|
if SELF_PATH.stem == "pyinstaller" or SELF_PATH.name == "gui.py":
|
||||||
SELF_PATH = Path(__file__).with_name("main.py").resolve()
|
SELF_PATH = Path(__file__).with_name("main.py").resolve()
|
||||||
WORKING_DIR = SELF_PATH.parent
|
WORKING_DIR = SELF_PATH.parent
|
||||||
|
DATA_DIR = Path(WORKING_DIR, "data")
|
||||||
# Development paths
|
# Development paths
|
||||||
VENV_PATH = Path(WORKING_DIR, "env")
|
VENV_PATH = Path(WORKING_DIR, "env")
|
||||||
SITE_PACKAGES_PATH = Path(VENV_PATH, SYS_SITE_PACKAGES)
|
SITE_PACKAGES_PATH = Path(VENV_PATH, SYS_SITE_PACKAGES)
|
||||||
@@ -100,13 +101,13 @@ SCRIPTS_PATH = Path(VENV_PATH, SYS_SCRIPTS)
|
|||||||
# NOTE: These don't have to be available to the end-user, so the path points to the internal dir
|
# NOTE: These don't have to be available to the end-user, so the path points to the internal dir
|
||||||
LANG_PATH = _resource_path("lang")
|
LANG_PATH = _resource_path("lang")
|
||||||
# Other Paths
|
# Other Paths
|
||||||
LOG_PATH = Path(WORKING_DIR, "log.txt")
|
LOG_PATH = Path(DATA_DIR, "log.txt")
|
||||||
DUMP_PATH = Path(WORKING_DIR, "dump.dat")
|
DUMP_PATH = Path(DATA_DIR, "dump.dat")
|
||||||
LOCK_PATH = Path(WORKING_DIR, "lock.file")
|
LOCK_PATH = Path(DATA_DIR, "lock.file")
|
||||||
CACHE_PATH = Path(WORKING_DIR, "cache")
|
CACHE_PATH = Path(DATA_DIR, "cache")
|
||||||
CACHE_DB = Path(CACHE_PATH, "mapping.json")
|
CACHE_DB = Path(CACHE_PATH, "mapping.json")
|
||||||
COOKIES_PATH = Path(WORKING_DIR, "cookies.jar")
|
COOKIES_PATH = Path(DATA_DIR, "cookies.jar")
|
||||||
SETTINGS_PATH = Path(WORKING_DIR, "settings.json")
|
SETTINGS_PATH = Path(DATA_DIR, "settings.json")
|
||||||
# Typing
|
# Typing
|
||||||
JsonType = Dict[str, Any]
|
JsonType = Dict[str, Any]
|
||||||
URLType = NewType("URLType", str)
|
URLType = NewType("URLType", str)
|
||||||
|
|||||||
@@ -187,7 +187,8 @@ if __name__ == "__main__":
|
|||||||
client.gui.status.update(_("gui", "status", "terminated"))
|
client.gui.status.update(_("gui", "status", "terminated"))
|
||||||
# notify the user about the closure
|
# notify the user about the closure
|
||||||
client.gui.grab_attention(sound=True)
|
client.gui.grab_attention(sound=True)
|
||||||
await client.gui.wait_until_closed()
|
# Docker: do not wait until close so docker can recognize the exit and restart
|
||||||
|
# await client.gui.wait_until_closed()
|
||||||
# save the application state
|
# save the application state
|
||||||
# NOTE: we have to do it after wait_until_closed,
|
# NOTE: we have to do it after wait_until_closed,
|
||||||
# because the user can alter some settings between app termination and closing the window
|
# because the user can alter some settings between app termination and closing the window
|
||||||
|
|||||||
Reference in new issue
Block a user