Add Dockerfile (python:3.11-slim), docker-compose.yml with volume mounts for webui/data/logs, and .dockerignore for minimal image size. Made-with: Cursor
24 lines
575 B
Docker
24 lines
575 B
Docker
FROM python:3.11-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# 使用清华源加速 pip
|
|
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
|
|
|
# 安装依赖
|
|
COPY requirements.txt .
|
|
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
# 拷贝后端代码
|
|
COPY api/ ./api/
|
|
|
|
# 拷贝编译后的前端产物
|
|
COPY api/webui/ ./api/webui/
|
|
|
|
# 创建数据和日志目录
|
|
RUN mkdir -p api/data api/logs
|
|
|
|
EXPOSE 23994
|
|
|
|
CMD ["python", "-c", "import sys; sys.path.insert(0, '/app/api'); import uvicorn; uvicorn.run('app.main:app', host='0.0.0.0', port=23994)"]
|