sailajaai commited on
Commit
8e474de
·
verified ·
1 Parent(s): c2a55c9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -5
Dockerfile CHANGED
@@ -5,15 +5,13 @@ FROM python:3.10-slim
5
  WORKDIR /app
6
 
7
  # Copy the requirements file first for layer caching
8
- # This assumes your requirements.txt is in the root of the space
9
  COPY requirements.txt .
10
 
11
- # Install dependencies, including Gunicorn for serving the app
12
- # The '--no-cache-dir' keeps the image size small
13
  RUN pip install --no-cache-dir -r requirements.txt
14
 
15
  # --- NLTK FIX: Download ALL necessary data as the root user ---
16
- # Set the environment variable to point NLTK to the local app folder.
17
  ENV NLTK_DATA=/app/nltk_data
18
 
19
  # Use the -d flag to force the downloader to put the data into the safe location
@@ -23,8 +21,13 @@ RUN python -m nltk.downloader -d /app/nltk_data stopwords
23
  RUN python -m nltk.downloader -d /app/nltk_data wordnet
24
  # --- NLTK FIX END ---
25
 
 
 
 
 
 
 
26
  # Copy the rest of your application code and folders
27
- # This includes app.py, services, routes, static, templates, etc.
28
  COPY . .
29
 
30
  # Hugging Face Spaces requires the app to listen on port 7860
 
5
  WORKDIR /app
6
 
7
  # Copy the requirements file first for layer caching
 
8
  COPY requirements.txt .
9
 
10
+ # Install dependencies
 
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
  # --- NLTK FIX: Download ALL necessary data as the root user ---
14
+ # NLTK_DATA environment variable points NLTK to the safe location
15
  ENV NLTK_DATA=/app/nltk_data
16
 
17
  # Use the -d flag to force the downloader to put the data into the safe location
 
21
  RUN python -m nltk.downloader -d /app/nltk_data wordnet
22
  # --- NLTK FIX END ---
23
 
24
+ # --- HUGGING FACE FIX: Redirect cache to a writable location ---
25
+ # HF_HOME tells Hugging Face/Transformers where to store models and cache files.
26
+ # /app/.cache is guaranteed to be writable by the running user.
27
+ ENV HF_HOME=/app/.cache
28
+ # --- HUGGING FACE FIX END ---
29
+
30
  # Copy the rest of your application code and folders
 
31
  COPY . .
32
 
33
  # Hugging Face Spaces requires the app to listen on port 7860