romybeaute commited on
Commit
f2ee42e
·
verified ·
1 Parent(s): 10de689

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -8
Dockerfile CHANGED
@@ -1,27 +1,37 @@
1
- FROM python:3.13.5-slim
2
 
3
  WORKDIR /app
4
 
 
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  curl \
8
  git \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  # 1. Copy ONLY the requirements file first
12
  COPY requirements.txt ./
13
 
14
  # 2. Run pip install (this layer will now be cached)
15
- RUN pip3 install -r requirements.txt
 
16
 
17
- # 3. Download the NLTK resources
18
- RUN python3 -c "import nltk; nltk.download('punkt'); nltk.download('stopwords')"
19
 
20
- # 4. NOW copy the rest of your app
 
 
 
 
 
 
 
 
 
 
21
  COPY app.py ./
22
- # We can add this back now, it won't break the cache
23
- # If you upload your 'data' folder, uncomment the next line
24
- # COPY data/ ./data/
25
 
26
  EXPOSE 8501
27
 
 
1
+ FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
+ # Add 'unzip' to the list of programs to install
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
9
  git \
10
+ unzip \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
  # 1. Copy ONLY the requirements file first
14
  COPY requirements.txt ./
15
 
16
  # 2. Run pip install (this layer will now be cached)
17
+ # We add your --extra-index-url fix back in, just in case
18
+ RUN pip3 install --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt
19
 
20
+ # 3. Create the standard NLTK data directory
21
+ RUN mkdir -p /usr/local/share/nltk_data
22
 
23
+ # 4. Download and unzip 'punkt'
24
+ RUN curl -L "https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/tokenizers/punkt.zip" -o /tmp/punkt.zip && \
25
+ unzip /tmp/punkt.zip -d /usr/local/share/nltk_data && \
26
+ rm /tmp/punkt.zip
27
+
28
+ # 5. Download and unzip 'stopwords'
29
+ RUN curl -L "https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/stopwords.zip" -o /tmp/stopwords.zip && \
30
+ unzip /tmp/stopwords.zip -d /usr/local/share/nltk_data && \
31
+ rm /tmp/stopwords.zip
32
+
33
+ # 6. NOW copy the rest of your app
34
  COPY app.py ./
 
 
 
35
 
36
  EXPOSE 8501
37