Files
track/backend/Dockerfile.dev

24 lines
793 B
Docker
Raw 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.

# ============================================================
# 后端开发 Dockerfile — FastAPI + Uvicorn 热更新
# ============================================================
FROM python:3.13-slim
WORKDIR /app
# 系统依赖Pillow / cryptography 编译所需)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
libffi-dev \
libjpeg-dev \
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
# 先装 Python 依赖(利用 Docker 缓存层,改代码不重装)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 代码通过 docker-compose volumes 挂载,不需要 COPY
# --reload 监听代码变化自动重启
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]