File size: 1,136 Bytes
2049c18
281236f
4ea128a
cefddb1
4ea128a
d2439ee
010f22b
 
f264a36
d2439ee
 
 
 
4ea128a
f264a36
4ea128a
2049c18
4ea128a
d2439ee
 
 
 
 
e7d6b5a
4ea128a
 
 
 
e7d6b5a
010f22b
5e76a95
e7d6b5a
 
 
 
 
2049c18
e7d6b5a
4ea128a
 
e7d6b5a
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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"]