feat: add texture download logic to entrypoint script for initial setup

This commit is contained in:
MayaTheShy
2026-03-26 13:10:53 -04:00
parent c74898049a
commit a50a6e9697

View File

@@ -8,6 +8,16 @@ mkdir -p /data
chown -R node:node /data chown -R node:node /data
echo "[entrypoint] /data permissions fixed" echo "[entrypoint] /data permissions fixed"
# Download textures if cache is empty (first run)
TEXTURE_DIR="/data/texture-cache/minecraft"
if [ ! -d "$TEXTURE_DIR" ] || [ -z "$(ls -A "$TEXTURE_DIR" 2>/dev/null)" ]; then
echo "[entrypoint] Downloading textures (first run)..."
su-exec node node /app/download-textures.js /data/texture-cache
echo "[entrypoint] Texture download complete"
else
echo "[entrypoint] Texture cache exists, skipping download"
fi
# Drop privileges and exec the CMD # Drop privileges and exec the CMD
echo "[entrypoint] Dropping to user 'node', running: $*" echo "[entrypoint] Dropping to user 'node', running: $*"
exec su-exec node "$@" exec su-exec node "$@"