File size: 3,252 Bytes
cd21c69
 
 
 
 
 
 
 
 
aeed0ef
cd21c69
d33e0ca
aeed0ef
 
d33e0ca
c29cdb2
aeed0ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d33e0ca
cd21c69
aeed0ef
 
d33e0ca
c29cdb2
aeed0ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c29cdb2
aeed0ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d33e0ca
cd21c69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
FROM ghcr.io/chenyme/grok2api:latest

ENV TZ=Asia/Shanghai \
    LOG_LEVEL=DEBUG \
    SERVER_PORT=8000

# 确保工作目录存在
WORKDIR /app

# 重新安装所有依赖(从 pyproject.toml)
RUN if [ -f /opt/venv/bin/activate ]; then \
        . /opt/venv/bin/activate && \
        if [ -f pyproject.toml ]; then \
            pip install --no-cache-dir -e .; \
        else \
            pip install --no-cache-dir \
                "aiofiles>=25.1.0" \
                "aiohttp>=3.13.3" \
                "aiohttp-socks>=0.11.0" \
                "aiomysql>=0.2.0" \
                "asyncpg>=0.31.0" \
                "cryptography>=46.0.5" \
                "curl-cffi>=0.13.0" \
                "fastapi>=0.119.0" \
                "granian>=2.7.2" \
                "greenlet>=3.3.1" \
                "livekit>=1.0.25" \
                "loguru>=0.7.3" \
                "orjson>=3.11.4" \
                "python-dotenv>=1.0.0" \
                "python-multipart>=0.0.21" \
                "redis>=6.4.0" \
                "sqlalchemy>=2.0.46" \
                "websockets>=16.0" \
                "uvicorn"; \
        fi \
    else \
        if [ -f pyproject.toml ]; then \
            pip3 install --no-cache-dir -e . || pip install --no-cache-dir -e .; \
        else \
            pip3 install --no-cache-dir \
                "aiofiles>=25.1.0" \
                "aiohttp>=3.13.3" \
                "aiohttp-socks>=0.11.0" \
                "aiomysql>=0.2.0" \
                "asyncpg>=0.31.0" \
                "cryptography>=46.0.5" \
                "curl-cffi>=0.13.0" \
                "fastapi>=0.119.0" \
                "granian>=2.7.2" \
                "greenlet>=3.3.1" \
                "livekit>=1.0.25" \
                "loguru>=0.7.3" \
                "orjson>=3.11.4" \
                "python-dotenv>=1.0.0" \
                "python-multipart>=0.0.21" \
                "redis>=6.4.0" \
                "sqlalchemy>=2.0.46" \
                "websockets>=16.0" \
                "uvicorn" || \
            pip install --no-cache-dir \
                "aiofiles>=25.1.0" \
                "aiohttp>=3.13.3" \
                "aiohttp-socks>=0.11.0" \
                "aiomysql>=0.2.0" \
                "asyncpg>=0.31.0" \
                "cryptography>=46.0.5" \
                "curl-cffi>=0.13.0" \
                "fastapi>=0.119.0" \
                "granian>=2.7.2" \
                "greenlet>=3.3.1" \
                "livekit>=1.0.25" \
                "loguru>=0.7.3" \
                "orjson>=3.11.4" \
                "python-dotenv>=1.0.0" \
                "python-multipart>=0.0.21" \
                "redis>=6.4.0" \
                "sqlalchemy>=2.0.46" \
                "websockets>=16.0" \
                "uvicorn"; \
        fi \
    fi

# 创建必要的目录
RUN mkdir -p /app/data /app/logs && chmod -R 777 /app/data /app/logs

# 拷入并强制转换格式(解决 Windows 换行符导致的找不到文件报错)
COPY entrypoint.sh /entrypoint.sh
RUN sed -i 's/\r$//' /entrypoint.sh && chmod +x /entrypoint.sh

# 验证文件是否存在
RUN ls -la /entrypoint.sh && head -1 /entrypoint.sh

EXPOSE 8000

# 使用 shell 形式的 CMD,更兼容
CMD ["/bin/sh", "/entrypoint.sh"]