Files
AIRegulation-Deployment/services/compliance-backend/Dockerfile

25 lines
653 B
Docker
Raw Normal View History

2026-04-23 09:58:47 +08:00
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# 使用 uv 加速依赖安装
RUN pip install uv --no-cache-dir
COPY pyproject.toml .
RUN uv pip install --system --no-cache -r pyproject.toml \
--index-url https://pypi.tuna.tsinghua.edu.cn/simple \
--trusted-host pypi.tuna.tsinghua.edu.cn
COPY app/ ./app/
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=5 \
CMD curl -f http://localhost:8000/health || exit 1
EXPOSE 8000
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "2"]