|
|
|
|
|
|
| FROM python:3.9-slim
|
|
|
|
|
| RUN useradd -m -u 1000 user
|
| USER user
|
|
|
|
|
| ENV PATH="/home/user/.local/bin:$PATH"
|
| ENV PYTHONUNBUFFERED=1
|
| ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
|
| WORKDIR /app
|
|
|
|
|
| COPY --chown=user requirements.txt requirements.txt
|
|
|
|
|
| RUN pip install --no-cache-dir --upgrade pip && \
|
| pip install --no-cache-dir --upgrade -r requirements.txt
|
|
|
|
|
| COPY --chown=user . /app
|
|
|
|
|
| RUN mkdir -p /app/data
|
|
|
|
|
| HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
| CMD python -c "import requests; requests.get('http://localhost:7860/health')"
|
|
|
|
|
| EXPOSE 7860
|
|
|
|
|
| CMD ["python", "app.py"]
|
|
|