kol-insight/backend/Dockerfile
zfc c53b5008df chore(backend): 迁移包管理工具从 pip 到 uv
- 新增 pyproject.toml 替代 requirements.txt,合并 pytest.ini 配置
- 添加 greenlet、httpx[socks] 依赖修复运行时错误
- 添加 basedpyright + ruff 开发工具及配置
- 更新 Dockerfile 使用 uv 安装依赖
- 更新 CLAUDE.md 所有后端命令为 uv 前缀
- 删除 requirements.txt 和 pytest.ini

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 17:14:36 +08:00

33 lines
781 B
Docker

FROM python:3.11-slim
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency files and install
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project
# Copy application code
COPY app/ ./app/
# Create non-root user
RUN useradd -m appuser && chown -R appuser:appuser /app
USER appuser
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
# Start application
CMD ["uv", "run", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]