forked from hsliuping/TradingAgents-CN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (44 loc) · 1.92 KB
/
Dockerfile
File metadata and controls
57 lines (44 loc) · 1.92 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
# 使用官方Python镜像替代GitHub Container Registry
FROM python:3.10-slim-bookworm
# 安装uv包管理器
RUN pip install -i https://mirrors.aliyun.com/pypi/simple uv
WORKDIR /app
RUN mkdir -p /app/data /app/logs
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
RUN echo 'deb http://mirrors.aliyun.com/debian/ bookworm main' > /etc/apt/sources.list && \
echo 'deb-src http://mirrors.aliyun.com/debian/ bookworm main' >> /etc/apt/sources.list && \
echo 'deb http://mirrors.aliyun.com/debian/ bookworm-updates main' >> /etc/apt/sources.list && \
echo 'deb-src http://mirrors.aliyun.com/debian/ bookworm-updates main' >> /etc/apt/sources.list && \
echo 'deb http://mirrors.aliyun.com/debian-security bookworm-security main' >> /etc/apt/sources.list && \
echo 'deb-src http://mirrors.aliyun.com/debian-security bookworm-security main' >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
wkhtmltopdf \
xvfb \
fonts-wqy-zenhei \
fonts-wqy-microhei \
fonts-liberation \
pandoc \
procps \
&& rm -rf /var/lib/apt/lists/*
# 启动Xvfb虚拟显示器
RUN echo '#!/bin/bash\nXvfb :99 -screen 0 1024x768x24 -ac +extension GLX &\nexport DISPLAY=:99\nexec "$@"' > /usr/local/bin/start-xvfb.sh \
&& chmod +x /usr/local/bin/start-xvfb.sh
COPY requirements.txt .
#多源轮询安装依赖
RUN set -e; \
for src in \
https://mirrors.aliyun.com/pypi/simple \
https://pypi.tuna.tsinghua.edu.cn/simple \
https://pypi.doubanio.com/simple \
https://pypi.org/simple; do \
echo "Try installing from $src"; \
pip install --no-cache-dir -r requirements.txt -i $src && break; \
echo "Failed at $src, try next"; \
done
# 复制日志配置文件
COPY config/ ./config/
COPY . .
EXPOSE 8501
CMD ["python", "-m", "streamlit", "run", "web/app.py", "--server.address=0.0.0.0", "--server.port=8501"]