# ================================================================ # VetCopilot 后端 Dockerfile # # 构建: docker build -f deploy/Dockerfile.backend -t vetcopilot-backend . # 运行: docker run -p 8080:8080 --env-file deploy/.env.production vetcopilot-backend # ================================================================ FROM python:3.12-slim # 安装系统依赖(FFmpeg 用于音频转码) RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ libsndfile1 \ curl \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # 安装 Python 依赖 COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # 可选:安装 FunASR(SenseVoice 引擎) # RUN pip install --no-cache-dir funasr sentencepiece # 复制应用代码 COPY . . # 创建数据目录 RUN mkdir -p /app/data /app/uploads/audio /app/uploads/exports /app/logs /app/backups # 暴露端口 EXPOSE 8080 # 健康检查 HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \ CMD curl -f http://localhost:8080/api/system/health || exit 1 # 启动 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8080"]