| 12345678910111213141516171819202122232425262728293031 |
- FROM python:3.10-slim
- WORKDIR /app
- ENV PYTHONDONTWRITEBYTECODE 1
- ENV PYTHONUNBUFFERED 1
- # Global setting to suppress "Running as root" warning for all pip commands
- ENV PIP_ROOT_USER_ACTION=ignore
- # Prevent debconf errors during build
- ARG DEBIAN_FRONTEND=noninteractive
- # Update apt source to TUNA (Optional, speeds up system package install) and install dependencies
- RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources || true \
- && apt-get update && apt-get install -y --no-install-recommends \
- gcc \
- default-libmysqlclient-dev \
- pkg-config \
- tzdata \
- && rm -rf /var/lib/apt/lists/*
- COPY requirements.txt .
- # Use Tsinghua PyPI Mirror & Upgrade pip
- RUN pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple \
- && pip install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
- COPY . .
- # Run application
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|