stock-analysis-api / docker-entrypoint.sh
vjeai's picture
Deploy: all fixes — yfinance candles, ml_signal 2y history, no handoff schemas, sequential report phase
3be03dd
Raw
History Blame Contribute Delete
622 Bytes
#!/bin/bash
set -e
# Train ML models if not already present (first boot only)
if [ ! -f "data/signal_model_stock.pkl" ]; then
echo "==> ML models not found, training now (this takes ~2-3 min)..."
python -c "
import os
os.makedirs('data', exist_ok=True)
from tools.tool_ml_train import train_model, train_etf_model
print('Training stock model...')
train_model()
print('Training ETF model...')
train_etf_model()
print('ML training complete.')
" || echo "Warning: ML training failed, app will run without ML signals"
fi
echo "==> Starting FastAPI server..."
exec uvicorn backend.main:app --host 0.0.0.0 --port 7860