| FROM python:3.9-slim |
|
|
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| gcc python3-dev curl && \ |
| rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN mkdir -p /app/models /app/huggingface /tmp/.streamlit && \ |
| chmod 777 /app/models /app/huggingface /tmp/.streamlit |
|
|
| |
| ENV TRANSFORMERS_CACHE=/app/models |
| ENV HF_HOME=/app/huggingface |
| ENV STREAMLIT_CONFIG_DIR=/tmp/.streamlit |
|
|
| |
| RUN echo "[server]\n\ |
| enableCORS = false\n\ |
| enableXsrfProtection = false\n\ |
| fileWatcherType = 'none'\n\ |
| [browser]\n\ |
| gatherUsageStats = false\n" > /tmp/.streamlit/config.toml |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY app.py . |
|
|
| |
| EXPOSE 8501 |
| HEALTHCHECK --interval=30s --timeout=5s CMD curl -f http://localhost:8501/_stcore/health |
|
|
| |
| CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"] |
|
|