# 1. Use Python 3.11 (Required for GECToR) FROM python:3.11-slim # 2. Install System Tools & Java 21 RUN apt-get update && \ apt-get install -y \ git \ wget \ openjdk-21-jre-headless \ build-essential \ python3-dev \ gcc \ && apt-get clean ENV JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 # 3. Setup Directories WORKDIR /app ENV XDG_CACHE_HOME=/app/cache ENV TRANSFORMERS_CACHE=/app/cache ENV HF_HOME=/app/cache RUN mkdir -p /app/cache && chmod 777 /app/cache # 4. Install Python Dependencies COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # 5. Setup data directory RUN mkdir -p /app/data # 5a. Download verb dictionary (needed by GECToR) # If you already have this file in your repo, this will just overwrite with same content. RUN echo "Downloading verb-form-vocab.txt for GECToR..." && \ wget -O /app/data/verb-form-vocab.txt \ https://github.com/grammarly/gector/raw/master/data/verb-form-vocab.txt # 6. Copy App Code COPY . . # 7. Run App CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]