| |
| FROM python:3.9-slim |
|
|
| |
| WORKDIR /app |
| ENV PYTHONUNBUFFERED=1 \ |
| TRANSFORMERS_CACHE=/app/model_cache \ |
| HF_HOME=/app/model_cache |
|
|
| |
| RUN apt-get update && \ |
| apt-get install -y --no-install-recommends \ |
| gcc \ |
| python3-dev \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN mkdir -p /app/model_cache && chmod 777 /app/model_cache |
|
|
| |
| COPY requirements.txt . |
| COPY app.py . |
|
|
| |
| RUN pip install --no-cache-dir -r requirements.txt && \ |
| python -c "from transformers import pipeline; pipeline('question-answering', model='distilbert-base-uncased-distilled-squad')" |
|
|
| |
| EXPOSE 8501 |
| HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \ |
| CMD curl -f http://localhost:8501/_stcore/health || exit 1 |
|
|
| CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] |