FROM python:3.12-slim-bookworm

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PIP_PROGRESS_BAR=off \
    PIP_NO_COLOR=1 \
    PIP_QUIET=1

WORKDIR /app

RUN pip install --no-input --no-cache-dir --upgrade pip setuptools wheel

COPY requirements.txt /app/requirements.txt
RUN pip install --no-input --no-cache-dir \
    -r /app/requirements.txt \
    -i https://pypi.tuna.tsinghua.edu.cn/simple/

COPY . /app

EXPOSE 8000
CMD ["python", "server.py"]