From dd431366c589836e7ffee3b4035ed88365fdc093 Mon Sep 17 00:00:00 2001 From: Lukas Pierchalla Date: Sun, 20 Sep 2026 12:28:27 +0200 Subject: [PATCH] update compose.yaml to adjust volume mappings; modify Dockerfile to install fewer packages and update entrypoint.sh for config directory handling --- Dockerfile | 4 ++-- compose.yaml | 5 +++-- entrypoint.sh | 21 ++++++++++----------- scalable_sync.py | 5 +---- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Dockerfile b/Dockerfile index d8a7529..f7b58a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,7 @@ ARG PUID=1000 ARG PGID=1000 RUN apt-get update && apt-get install -y --no-install-recommends \ - gosu dbus-x11 gnome-keyring libpam-gnome-keyring \ + gosu dbus \ && rm -rf /var/lib/apt/lists/* RUN groupadd -g ${PGID} appgroup \ @@ -43,7 +43,7 @@ COPY scalable_sync.py . COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh -ENV SC_CONFIG_DIR=/tmp/sc-config +ENV XDG_CONFIG_HOME=/home/appuser/.config ENV PUID=${PUID} ENV PGID=${PGID} diff --git a/compose.yaml b/compose.yaml index e5b20b6..e32e2a5 100644 --- a/compose.yaml +++ b/compose.yaml @@ -12,7 +12,7 @@ services: restart: unless-stopped volumes: - scalable-sync-data:/app/data - - ${HOME}/.config/scalable-cli:/tmp/sc-config:ro + - scalable-sync-sc-config:/home/appuser/.config/scalable-cli env_file: - .env command: ["--daemon"] @@ -24,4 +24,5 @@ services: start_period: 30s volumes: - scalable-sync-data: \ No newline at end of file + scalable-sync-data: + scalable-sync-sc-config: \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index cde898d..c42d827 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,21 +3,20 @@ set -e chown -R ${PUID:-1000}:${PGID:-1000} /app/data 2>/dev/null || true -# Wenn der erste Parameter "python" ist → shift und ggf. Skript-Pfad auch entfernen -if [ "$1" = "python" ]; then - shift - # Wenn das nächste Argument das Skript selbst ist → auch entfernen - if [ "$1" = "/app/scalable_sync.py" ]; then - shift - fi - exec gosu appuser python /app/scalable_sync.py "$@" +# sc liest config.toml aus $XDG_CONFIG_HOME/scalable-cli/ (Linux-Standard) +SC_CONF_DIR="${XDG_CONFIG_HOME:-/home/appuser/.config}/scalable-cli" +mkdir -p "${SC_CONF_DIR}" +if [ ! -f "${SC_CONF_DIR}/config.toml" ]; then + cat > "${SC_CONF_DIR}/config.toml" <<'EOF' +[auth] +session_backend = "file" +signing_key_backend = "file" +EOF fi -# Wenn das Skript direkt als erster Parameter kommt -if [ "$1" = "/app/scalable_sync.py" ]; then +if [ "$1" = "python" ] || [ "$1" = "/app/scalable_sync.py" ]; then shift exec gosu appuser python /app/scalable_sync.py "$@" fi -# Sonst: Befehl direkt als appuser ausführen (z. B. sc login) exec gosu appuser "$@" \ No newline at end of file diff --git a/scalable_sync.py b/scalable_sync.py index 5e4a1a0..21cfd81 100644 --- a/scalable_sync.py +++ b/scalable_sync.py @@ -35,9 +35,6 @@ SC_SETTLED_ONLY = os.getenv("SC_SETTLED_ONLY", "true").lower() == "true" SC_MAPPING_VERSION = int(os.getenv("SC_MAPPING_VERSION", "1")) ASSET_MAP = json.loads(os.getenv("ASSET_MAP", "{}")) -# SC_CONFIG_DIR wird vom Entrypoint gesetzt und als read-only Bind-Mount eingehängt -SC_CONFIG_DIR = Path(os.getenv("SC_CONFIG_DIR", "/tmp/sc-config")) -os.environ["SC_CONFIG_DIR"] = str(SC_CONFIG_DIR) DATA_DIR = Path("/app/data") DATA_DIR.mkdir(exist_ok=True) @@ -58,7 +55,7 @@ log = logging.getLogger("scalable-sync") def sc(*args: str, timeout: int = 60) -> dict: cmd = ["sc"] + list(args) - env = {**os.environ, "HOME": "/home/appuser", "SC_CONFIG_DIR": str(SC_CONFIG_DIR)} + env = {**os.environ, "HOME": "/home/appuser", "XDG_CONFIG_HOME": "/home/appuser/.config"} result = subprocess.run(cmd, capture_output=True, text=True, timeout=timeout, env=env) if result.returncode != 0: log.error("sc failed: %s", result.stderr)