-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (23 loc) · 741 Bytes
/
Dockerfile
File metadata and controls
32 lines (23 loc) · 741 Bytes
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
# 1. Base Image
FROM python:3.9-slim
# 2. Set Working Directory and Python Path
WORKDIR /app
ENV PYTHONPATH="."
ENV NLTK_DATA="/app/nltk_data"
ENV HF_HOME="/app/cache/huggingface"
ENV HF_DATASETS_CACHE="/app/cache/datasets"
ENV TRANSFORMERS_CACHE="/app/cache/transformers"
# 4. Copy and Install Dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 5. Download NLTK data
RUN python -m nltk.downloader -d $NLTK_DATA punkt punkt_tab
# 6. Copy and run the model download script
COPY download_models.py .
RUN python download_models.py
# 7. Copy the rest of the application code
COPY . .
# 8. Expose Port
EXPOSE 8000
# 9. Run Command
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]