File size: 924 Bytes
9c12276
3ceb7bf
 
e654cb0
9c12276
3ceb7bf
 
 
9c12276
 
 
 
 
 
 
 
 
 
 
 
3ceb7bf
 
9c12276
 
3ceb7bf
9c12276
 
e654cb0
9c12276
 
 
3ceb7bf
9c12276
3ceb7bf
 
1acd7b0
3ceb7bf
e654cb0
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
FROM python:3.11-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    NLTK_DATA=/usr/local/nltk_data

WORKDIR /app

# install deps
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    python3-dev \
    libffi-dev \
    libssl-dev \
    rustc \
    cargo \
 && rm -rf /var/lib/apt/lists/*

# upgrade pip
RUN python -m pip install --upgrade pip setuptools wheel

# install nltk + required packages before copying app
RUN pip install --no-cache-dir nltk

# download nltk models inside image (not at runtime)
RUN python -m nltk.downloader -d /usr/local/nltk_data punkt averaged_perceptron_tagger averaged_perceptron_tagger_eng

# copy requirements and install
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt

# copy app
COPY . /app

EXPOSE 7860

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]