Files
SubTracker/docker/entrypoint.sh
SmileQWQ 47b485b709 fix: support configurable container timezone
- add TZ to API compose defaults and example env config
- keep tzdata in the image without hardcoding a single timezone
- apply the runtime TZ value from entrypoint so users can switch timezones cleanly

# Conflicts:
#	apps/api/.env.example
2026-04-21 11:07:09 +08:00

31 lines
783 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
set -eu
APP_ROOT="/app"
SCHEMA_PATH="$APP_ROOT/apps/api/prisma/schema.prisma"
PRISMA_BIN="$APP_ROOT/node_modules/.bin/prisma"
mkdir -p "$APP_ROOT/data" "$APP_ROOT/apps/api/storage/logos"
if [ -n "${TZ:-}" ] && [ -f "/usr/share/zoneinfo/$TZ" ]; then
ln -sf "/usr/share/zoneinfo/$TZ" /etc/localtime
echo "$TZ" > /etc/timezone
fi
if [ "${SKIP_DB_PUSH:-false}" != "true" ]; then
if [ ! -x "$PRISMA_BIN" ]; then
echo "[api] 未找到 Prisma CLI$PRISMA_BIN" >&2
exit 1
fi
if [ ! -f "$SCHEMA_PATH" ]; then
echo "[api] 未找到 Prisma schema$SCHEMA_PATH" >&2
exit 1
fi
echo "[api] 正在检查并初始化数据库结构..."
"$PRISMA_BIN" db push --skip-generate --schema "$SCHEMA_PATH"
fi
exec node "$APP_ROOT/apps/api/dist/index.js"