| FROM python:3.11-slim
|
|
|
|
|
| WORKDIR /app
|
|
|
|
|
| ENV PYTHONUNBUFFERED=1 \
|
| PYTHONDONTWRITEBYTECODE=1 \
|
| PORT=7860 \
|
| TZ=UTC
|
|
|
|
|
| RUN apt-get update && apt-get install -y --no-install-recommends \
|
| curl \
|
| tzdata \
|
| && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
| COPY requirements.txt .
|
| RUN pip install --no-cache-dir --upgrade pip && \
|
| pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
| COPY app.py .
|
|
|
|
|
| RUN useradd -m -u 1000 user && \
|
| chown -R user:user /app
|
|
|
| USER user
|
|
|
|
|
| EXPOSE 7860
|
|
|
|
|
| HEALTHCHECK --interval=60s --timeout=10s --start-period=10s --retries=3 \
|
| CMD curl -f http://localhost:7860/health || exit 1
|
|
|
|
|
| CMD ["python", "app.py"] |