|
FROM python:3.9-slim |
|
|
|
|
|
RUN apt-get update && apt-get install -y \ |
|
git \ |
|
gcc \ |
|
g++ \ |
|
curl \ |
|
libopenblas-dev \ |
|
python3-dev \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
|
|
RUN mkdir -p /app/cache && chmod 777 /app/cache |
|
|
|
WORKDIR /app |
|
|
|
|
|
ENV TRANSFORMERS_CACHE=/app/cache \ |
|
HF_HOME=/app/cache \ |
|
PYTHONWARNINGS="ignore" \ |
|
NPY_NO_DEPRECATED_API=1 \ |
|
XDG_CACHE_HOME=/app/cache \ |
|
PRELOAD_MODEL=false \ |
|
TOKENIZERS_PARALLELISM=false |
|
|
|
COPY requirements.txt . |
|
|
|
|
|
RUN pip install --no-cache-dir --upgrade pip && \ |
|
pip install --no-cache-dir numpy==1.26.4 && \ |
|
pip install --no-cache-dir -r requirements.txt |
|
|
|
COPY app.py . |
|
|
|
EXPOSE 5000 |
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \ |
|
CMD curl -f http://localhost:5000/health || exit 1 |
|
|
|
|
|
CMD ["gunicorn", "app:app", "--workers=1", "--threads=1", "--timeout=300", "--bind=0.0.0.0:5000"] |
|
|