model-bot / Dockerfile
MHD011's picture
Upload 3 files
d43bf55 verified
raw
history blame
623 Bytes
FROM python:3.9-slim
WORKDIR /app
RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
COPY . .
RUN mkdir -p /app/model_cache && chmod -R 777 /app
RUN pip install --upgrade pip setuptools wheel
RUN pip install numpy==1.24.4
RUN pip install --no-cache-dir -r requirements.txt
ENV FLASK_APP=app.py
ENV FLASK_ENV=production
ENV TRANSFORMERS_CACHE=/app/model_cache
ENV TORCH_CACHE=/app/model_cache
EXPOSE 7860
CMD ["gunicorn", "--workers", "1", "--threads", "2", "--bind", "0.0.0.0:7860", "--timeout", "300", "--preload", "app:app"]