Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +26 -0
Dockerfile
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.10-slim
|
2 |
+
|
3 |
+
# System dependencies
|
4 |
+
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*
|
5 |
+
|
6 |
+
# Install Python deps first
|
7 |
+
COPY requirements.txt .
|
8 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
9 |
+
|
10 |
+
# Set environment variables
|
11 |
+
ENV NLTK_DATA=/usr/local/nltk_data
|
12 |
+
ENV HF_HOME=/usr/local/huggingface_cache
|
13 |
+
|
14 |
+
# Create writable directories
|
15 |
+
RUN mkdir -p $NLTK_DATA $HF_HOME
|
16 |
+
|
17 |
+
# Download NLTK, spaCy model, and sentence-transformers model at build time
|
18 |
+
RUN python -m nltk.downloader punkt && \
|
19 |
+
python -m spacy download en_core_web_sm && \
|
20 |
+
python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
|
21 |
+
|
22 |
+
# Set working directory and copy app code
|
23 |
+
WORKDIR /app
|
24 |
+
COPY . .
|
25 |
+
|
26 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
|