| FROM python:3.14-slim |
|
|
| WORKDIR /app |
|
|
| |
| ENV PYTHONDONTWRITEBYTECODE=1 \ |
| PYTHONUNBUFFERED=1 \ |
| PIP_NO_CACHE_DIR=1 \ |
| PIP_DISABLE_PIP_VERSION_CHECK=1 |
|
|
| |
| RUN apt-get update && \ |
| apt-get upgrade -y && \ |
| apt-get clean && \ |
| rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN useradd -m -u 1000 -s /bin/bash user |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --no-cache-dir --upgrade pip && \ |
| pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY --chown=user:user . . |
|
|
| |
| USER user |
|
|
| |
| ENV PATH="/home/user/.local/bin:$PATH" \ |
| HOME="/home/user" |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=15s --retries=3 \ |
| CMD python3 -c "import os, requests; port=os.environ.get('PORT','7860'); requests.get(f'http://localhost:{port}/health', timeout=5)" |
|
|
| |
| EXPOSE 7860 |
|
|
| |
| |
| CMD ["sh", "-c", "uvicorn server:app --host 0.0.0.0 --port ${PORT:-7860} --log-level ${LOG_LEVEL:-info} --no-access-log --workers ${WEB_CONCURRENCY:-1}"] |
|
|
|
|