ConGrs / Dockerfile
Shahzaib98's picture
Upload Dockerfile
51935fe verified
FROM python:3.10-slim
WORKDIR /app
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
# Install minimal system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Copy requirements
COPY requirements.txt .
# Upgrade pip
RUN pip install --upgrade pip
# Install PyTorch CPU (lighter weight)
RUN pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu
# Install all other dependencies in one go
RUN pip install -r requirements.txt
# Download spaCy model with direct URL (more reliable)
RUN pip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.7.1/en_core_web_sm-3.7.1-py3-none-any.whl
# Copy app code
COPY . .
EXPOSE 7860
CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "120", "--workers", "2", "app:app"]