update compose.yaml to adjust volume mappings; modify Dockerfile to install fewer packages and update entrypoint.sh for config directory handling
This commit is contained in:
+2
-2
@@ -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}
|
||||
|
||||
|
||||
+3
-2
@@ -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:
|
||||
scalable-sync-data:
|
||||
scalable-sync-sc-config:
|
||||
+10
-11
@@ -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 "$@"
|
||||
+1
-4
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user