Files
Andre 77c63770c3 fix: create data subdirectories on first container start
On a host that has never run the service, the mounted data volume is
empty. Ownership was being corrected for a subdirectory that did not
exist yet, which aborted the entrypoint before the application started
— exactly the situation a fresh deployment creates, and the reason the
container came up on the existing Pi but would not have elsewhere.

Creating the directory has to happen at runtime rather than during the
build, because the volume mount hides whatever the image places there.
2026-08-14 16:20:54 +02:00

18 lines
691 B
Bash

#!/bin/sh
set -e
APP_UID=${APP_UID:-1000}
APP_GID=${APP_GID:-1000}
# Mounted volumes start out empty on a fresh host, and a mount hides anything the
# image created at these paths — so create the directories here, not at build time
mkdir -p /app/tmp /app/data/images
chown "${APP_UID}:${APP_GID}" /app/tmp /app/data /app/data/images
# Self-update yt-dlp on every container start (Instagram/TikTok break old versions).
# Must not block or fail the boot: network may not be up yet after a Pi reboot.
timeout 60 yt-dlp -U || echo "yt-dlp self-update failed, continuing with installed version"
# Drop from root to app user and run the actual command
exec gosu "${APP_UID}:${APP_GID}" "$@"