FROM python:3.12-slim

# Install uv.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/


WORKDIR /env_build

# Copy the application into the container.
COPY pyproject.toml uv.lock ./

RUN uv sync --frozen --no-cache

ENV PATH="/env_build/.venv/bin:$PATH"

# Install the application dependencies.
WORKDIR /app

# 更新索引并安装替代包
RUN apt-get update && apt-get install -y vim

#CMD ["tail","-f","/dev/null"]
# Run the application.
CMD ["gunicorn", "main:app_server", \
     "-w", "4", \
     "-k", "uvicorn.workers.UvicornWorker", \
     "--bind", "0.0.0.0:80", \
     "--access-logfile", "-", \
     "--error-logfile", "-"]