| |
| |
| |
| |
| |
| FROM python:3.11-slim |
|
|
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| curl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --upgrade pip && \ |
| pip install --no-cache-dir torch==2.6.0+cpu --index-url https://download.pytorch.org/whl/cpu && \ |
| pip install --no-cache-dir -r requirements.txt |
| |
| COPY . . |
|
|
| |
| ENV PORT=8000 |
| ENV HOST=0.0.0.0 |
|
|
| |
| ENV TRANSFORMERS_CACHE=/app/model_cache |
| ENV HF_HOME=/app/model_cache |
|
|
| |
| RUN mkdir -p /app/model_cache && chmod -R 777 /app/model_cache |
|
|
| |
| RUN python -c "from transformers import pipeline; pipeline('token-classification', model='Isotonic/deberta-v3-base_finetuned_ai4privacy_v2')" && \ |
| chmod -R 777 /app/model_cache |
|
|
|
|
| |
| EXPOSE $PORT |
|
|
| |
| HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \ |
| CMD curl -f http://localhost:${PORT}/health || exit 1 |
|
|
| CMD ["python", "main.py"] |
|
|