alphax/docker/entrypoint.sh
2026-05-13 22:49:47 +08:00

31 lines
582 B
Bash
Executable File
Raw 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.

#!/usr/bin/env bash
set -euo pipefail
cd /app
mkdir -p /app/data /app/logs
export ALPHAX_DB_PATH="${ALPHAX_DB_PATH:-/app/data/altcoin_monitor.db}"
# 若首次启动没有 DB则创建空文件init_db 会补表结构。
if [ ! -e "$ALPHAX_DB_PATH" ]; then
touch "$ALPHAX_DB_PATH"
fi
case "${1:-web}" in
web)
exec python -m uvicorn app.web.web_server:app --host 0.0.0.0 --port "${PORT:-8190}"
;;
scheduler)
exec python /app/docker/scheduler.py
;;
once)
shift
exec python "$@"
;;
shell)
exec bash
;;
*)
exec "$@"
;;
esac