| FROM python:3.10-slim | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| python3-dev \ | |
| gcc \ | |
| g++ \ | |
| cmake \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Upgrade pip | |
| RUN pip install --upgrade pip setuptools wheel | |
| # Copy requirements first | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install the Tagalog model wheel using a valid local filename. | |
| # The upstream filename omits version and fails pip validation when installed by URL. | |
| RUN python -c "import urllib.request, subprocess, sys; u='https://huggingface.co/ljvmiranda921/tl_calamancy_md/resolve/main/tl_calamancy_md-any-py3-none-any.whl'; p='/tmp/tl_calamancy_md-0.2.0-py3-none-any.whl'; urllib.request.urlretrieve(u, p); subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--no-deps', p])" | |
| # Copy the rest of your app | |
| COPY . . | |
| # Don't try to download models during build - let app handle it at runtime | |
| # Just create the models directory if needed | |
| RUN mkdir -p /app/models | |
| EXPOSE 7860 | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers=1", "--threads=2", "app:app"] |