File size: 1,071 Bytes
457ced4
 
 
 
20fef51
 
 
 
 
e610a2f
95af174
e610a2f
 
 
 
 
 
20fef51
 
 
 
6d4e710
48fa57d
457ced4
 
354f67f
457ced4
 
 
 
 
 
 
 
 
2b90d6f
 
 
57429e6
bf4ba2a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
FROM python:3.12-slim

WORKDIR /app

ENV LIGHTWEIGHT_MODE=1 \
    MODEL_MEM_CACHE_SIZE=3 \
    INSTITUTIONAL_FLOW_DAYS=60 \
    INSTITUTIONAL_FLOW_WORKERS=2 \
    ENABLE_OPTUNA=0 \
    ENABLE_NEWS_OVERLAY=0 \
    ENABLE_PUBLIC_NEWS_ENDPOINT=0 \
    ENABLE_TAIFEX_FLOW=0 \
    ENABLE_REVENUE_FEATURES=0 \
    ENABLE_SECURITIES_LENDING=0 \
    ENABLE_BLOCK_TRADE_FEATURES=0 \
    ENABLE_LARGE_HOLDER_FEATURES=0 \
    LOCAL_PRECOMPUTE_FRESH_HOURS=96 \
    MPLBACKEND=Agg \
    WARMUP_STOCKS="" \
    PYTHONUNBUFFERED=1

RUN apt-get update && apt-get install -y --no-install-recommends curl fonts-noto-cjk libgomp1 && rm -rf /var/lib/apt/lists/*

# Install dependencies first (cached layer)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy source
COPY . .

# Create model cache directory
RUN mkdir -p model_cache

EXPOSE 7860

HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
  CMD curl -f http://localhost:7860/health || exit 1

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]
# build: 2026-03-29