| # Use Python 3.10 as the base image | |
| FROM python:3.10-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Copy requirements.txt | |
| COPY requirements.txt . | |
| # Install system dependencies and Python packages | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| python3-dev \ | |
| && pip install --no-cache-dir -r requirements.txt \ | |
| && python -m spacy download en_core_web_sm \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy all files | |
| COPY . . | |
| # Ensure write permissions for SQLite database | |
| RUN chmod -R 777 /app | |
| # Run the application | |
| CMD ["python", "app.py"] |