-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
77 lines (67 loc) · 2.86 KB
/
Copy pathDockerfile
File metadata and controls
77 lines (67 loc) · 2.86 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# FactorGPT — LLM-Powered Quantitative Factor Mining & Industrialization Platform
#
# Build: docker build -t factorgpt:latest .
# Run: docker-compose up -d
# Quick: docker run -d -p 8501:8501 factorgpt:latest
#
# Environment:
# DEEPSEEK_API_KEY - DeepSeek API key (optional, defaults to offline/synthetic)
# OPENAI_API_KEY - OpenAI API key (optional)
# TUSHARE_TOKEN - Tushare Pro token (optional, for real A-share data)
# FACTORGPT_LLM_PROVIDER - Override LLM provider (default: ollama)
# FACTORGPT_LLM_MODEL - Override LLM model (default: qwen2.5-coder:7b)
# HF_ENDPOINT - HuggingFace mirror (default: https://hf-mirror.com)
FROM python:3.11-slim
# ============================================================
# Environment Configuration
# ============================================================
ENV PYTHONUNBUFFERED=1 \
PYTHONPATH=/app/src \
PIP_NO_CACHE_DIR=1 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
HF_ENDPOINT=https://hf-mirror.com \
STREAMLIT_SERVER_PORT=8501 \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_HEADLESS=true \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
WORKDIR /app
# ============================================================
# System Dependencies
# ============================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
git \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# ============================================================
# Python Dependencies (Layer Cache Optimization)
# ============================================================
# Prefer locked requirements for reproducible builds
COPY requirements.lock.txt /app/requirements.lock.txt
COPY requirements.txt /app/requirements.txt
RUN pip install --upgrade pip \
&& pip install -r requirements.lock.txt 2>/dev/null \
|| pip install -r requirements.txt
# ============================================================
# Application Source
# ============================================================
COPY . /app
# Create data and cache directories
RUN mkdir -p /app/data/cache /app/chroma_db
# ============================================================
# Health Check
# ============================================================
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:8501/_stcore/health || exit 1
# ============================================================
# Expose & Run
# ============================================================
EXPOSE 8501
# Default: Streamlit 17-page web interface
# Override CMD to run CLI: docker run factorgpt python run_agent.py "..."
CMD ["streamlit", "run", "src/ui/app.py", \
"--server.port=8501", \
"--server.address=0.0.0.0", \
"--server.headless=true", \
"--browser.gatherUsageStats=false"]