Bodyless commited on
Commit
d7fee50
·
verified ·
1 Parent(s): f867fd7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -1
Dockerfile CHANGED
@@ -1,23 +1,41 @@
1
-
2
  FROM nvcr.io/nvidia/pytorch:23.09-py3
3
 
 
4
  WORKDIR /app
5
 
 
6
  RUN apt-get update && apt-get install -y \
7
  curl \
8
  git \
9
  build-essential \
10
  && rm -rf /var/lib/apt/lists/*
11
 
 
 
 
 
 
12
  COPY requirements.txt ./
13
  RUN pip install --no-cache-dir numpy==1.24.4
 
 
 
 
 
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
 
 
 
16
  RUN python3 -m spacy download en_core_web_sm
17
 
 
18
  COPY src/ ./src/
19
 
 
20
  EXPOSE 8501
21
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
22
 
 
23
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ # 1. Use an official PyTorch base image
2
  FROM nvcr.io/nvidia/pytorch:23.09-py3
3
 
4
+ # Set working directory inside the container
5
  WORKDIR /app
6
 
7
+ # Install system dependencies (curl, git, etc.)
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 1: Pin NumPy AND Force Reinstallation of PyTorch
16
+ # ----------------------------------------------------------------------
17
+
18
+ # 1a. Copy requirements and install the pinned NumPy version first
19
  COPY requirements.txt ./
20
  RUN pip install --no-cache-dir numpy==1.24.4
21
+
22
+ # 1b. Force re-install PyTorch to link it correctly with the new NumPy 1.24.4 version
23
+ RUN pip install --no-cache-dir torch
24
+
25
+ # 1c. Install remaining Python packages from requirements
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
+ # ----------------------------------------------------------------------
29
+
30
+ # CRITICAL FIX 2: Download the spaCy language model data
31
  RUN python3 -m spacy download en_core_web_sm
32
 
33
+ # Copy application source code to the container
34
  COPY src/ ./src/
35
 
36
+ # Expose the port Streamlit runs on
37
  EXPOSE 8501
38
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
39
 
40
+ # Command to run the Streamlit application
41
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]