32 lines
798 B
Docker
32 lines
798 B
Docker
|
|
FROM python:3.11-slim
|
||
|
|
|
||
|
|
LABEL maintainer="trading-signal"
|
||
|
|
LABEL description="A股纯信号量化交易系统"
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# 系统依赖
|
||
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
|
|
tzdata curl && \
|
||
|
|
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
|
||
|
|
echo "Asia/Shanghai" > /etc/timezone && \
|
||
|
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||
|
|
|
||
|
|
# Python依赖
|
||
|
|
COPY requirements.txt .
|
||
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
||
|
|
|
||
|
|
# 应用代码
|
||
|
|
COPY scripts/ /app/scripts/
|
||
|
|
COPY config/ /app/config/
|
||
|
|
|
||
|
|
# 数据和日志通过volume挂载
|
||
|
|
VOLUME ["/app/data", "/app/logs"]
|
||
|
|
|
||
|
|
# 健康检查
|
||
|
|
HEALTHCHECK --interval=60s --timeout=10s --retries=3 \
|
||
|
|
CMD test -f /app/data/state.json || exit 1
|
||
|
|
|
||
|
|
# 启动
|
||
|
|
CMD ["python3", "-u", "/app/scripts/scheduler.py"]
|