Files
AiTool/Dockerfile.backend
2026-03-18 17:01:10 +08:00

21 lines
605 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 分层构建:避免依赖第三方基础镜像(例如 tiangolo拉取失败
FROM python:3.11-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# 依赖层:只有 requirements 变更时才重建
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# 代码层:仅此层会随业务代码变更而重建
COPY backend /app/backend
EXPOSE 8000
# SQLite 对并发写不友好,单进程即可;如需生产多 worker 可在 compose 里调整
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]