Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +11 -14
Dockerfile
CHANGED
|
@@ -1,33 +1,30 @@
|
|
| 1 |
-
# 1.
|
| 2 |
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
| 3 |
|
| 4 |
-
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
curl \
|
| 10 |
git \
|
| 11 |
build-essential \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
-
#
|
| 15 |
-
# CRITICAL FIX: Install dependencies in the correct order
|
| 16 |
-
# ----------------------------------------------------------------------
|
| 17 |
-
|
| 18 |
-
# Install all Python packages (including pinned NumPy, which is necessary for spaCy)
|
| 19 |
COPY requirements.txt ./
|
| 20 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 21 |
|
| 22 |
-
# CRITICAL
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
RUN python3 -m spacy download en_core_web_sm
|
| 24 |
|
| 25 |
-
# Copy
|
| 26 |
COPY src/ ./src/
|
| 27 |
|
| 28 |
-
# Expose
|
| 29 |
EXPOSE 8501
|
| 30 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 31 |
-
|
| 32 |
-
# Command to run the Streamlit application
|
| 33 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 1 |
+
# 1. Use the stable PyTorch 2.0.1 base image
|
| 2 |
FROM pytorch/pytorch:2.0.1-cuda11.7-cudnn8-runtime
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Install system dependencies
|
| 8 |
RUN apt-get update && apt-get install -y \
|
| 9 |
curl \
|
| 10 |
git \
|
| 11 |
build-essential \
|
| 12 |
&& rm -rf /var/lib/apt/lists/*
|
| 13 |
|
| 14 |
+
# 2. Copy requirements
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
COPY requirements.txt ./
|
|
|
|
| 16 |
|
| 17 |
+
# 3. CRITICAL: Force reinstall to ensure we get Transformers 4.32.0 and NumPy 1.24.4
|
| 18 |
+
# This overwrites any pre-installed versions in the base image
|
| 19 |
+
RUN pip install --no-cache-dir --upgrade --force-reinstall -r requirements.txt
|
| 20 |
+
|
| 21 |
+
# 4. Download spaCy model
|
| 22 |
RUN python3 -m spacy download en_core_web_sm
|
| 23 |
|
| 24 |
+
# 5. Copy your source code (Ensure your code is in src/streamlit_app.py)
|
| 25 |
COPY src/ ./src/
|
| 26 |
|
| 27 |
+
# 6. Expose port and run
|
| 28 |
EXPOSE 8501
|
| 29 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
|
|
|
|
|
|
| 30 |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|