Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +15 -16
Dockerfile
CHANGED
|
@@ -2,38 +2,37 @@ FROM python:3.10-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# 1. Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
gcc \
|
| 8 |
python3-dev \
|
| 9 |
-
git \
|
| 10 |
libgomp1 \
|
| 11 |
libopenblas-dev \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
# 2. First install
|
| 15 |
RUN pip install --upgrade pip && \
|
| 16 |
-
pip install
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
# 3.
|
| 19 |
-
RUN
|
|
|
|
| 20 |
|
| 21 |
-
# 4. Install
|
| 22 |
-
RUN pip install \
|
| 23 |
-
|
| 24 |
-
faiss-cpu==1.7.4 \
|
| 25 |
-
--no-cache-dir
|
| 26 |
|
| 27 |
-
# 5.
|
| 28 |
COPY requirements.txt .
|
| 29 |
-
RUN pip install
|
| 30 |
-
python -m spacy download en_core_web_sm && \
|
| 31 |
-
python -m nltk.downloader punkt wordnet
|
| 32 |
|
| 33 |
# 6. Copy application files
|
| 34 |
COPY . .
|
| 35 |
|
| 36 |
-
# Environment configuration
|
| 37 |
ENV STREAMLIT_SERVER_PORT=7860
|
| 38 |
EXPOSE 7860
|
| 39 |
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# 1. Install essential system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
gcc \
|
| 8 |
python3-dev \
|
|
|
|
| 9 |
libgomp1 \
|
| 10 |
libopenblas-dev \
|
| 11 |
&& rm -rf /var/lib/apt/lists/*
|
| 12 |
|
| 13 |
+
# 2. First install only absolutely critical packages
|
| 14 |
RUN pip install --upgrade pip && \
|
| 15 |
+
pip install --no-cache-dir \
|
| 16 |
+
spacy==3.7.4 \
|
| 17 |
+
nltk==3.8.1 \
|
| 18 |
+
python-dotenv==1.0.0
|
| 19 |
|
| 20 |
+
# 3. Download NLP models (done before other installs to prevent conflicts)
|
| 21 |
+
RUN python -m spacy download en_core_web_sm && \
|
| 22 |
+
python -m nltk.downloader punkt wordnet
|
| 23 |
|
| 24 |
+
# 4. Install PyTorch CPU version explicitly
|
| 25 |
+
RUN pip install --no-cache-dir \
|
| 26 |
+
torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu
|
|
|
|
|
|
|
| 27 |
|
| 28 |
+
# 5. Install remaining requirements in one go to minimize layers
|
| 29 |
COPY requirements.txt .
|
| 30 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# 6. Copy application files
|
| 33 |
COPY . .
|
| 34 |
|
| 35 |
+
# 7. Environment configuration
|
| 36 |
ENV STREAMLIT_SERVER_PORT=7860
|
| 37 |
EXPOSE 7860
|
| 38 |
|