# Use slim Python image FROM python:3.10-slim # Set environment variables for performance ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ OMP_NUM_THREADS=1 \ MKL_NUM_THREADS=1 \ OPENBLAS_NUM_THREADS=1 \ VECLIB_MAXIMUM_THREADS=1 \ NUMEXPR_NUM_THREADS=1 # Set working directory WORKDIR /app # Copy requirements and apt dependencies first COPY requirements.txt apt.txt /app/ # Install system dependencies and clean up RUN apt-get update && \ xargs -a apt.txt apt-get install -y && \ apt-get clean && rm -rf /var/lib/apt/lists/* # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Download spaCy model RUN python -m spacy download en_core_web_sm # Copy application files and models COPY . /app/ # Expose Flask's default port EXPOSE 7860 # Run the app CMD ["python", "app.py"]