zyxciss commited on
Commit
812f613
·
verified ·
1 Parent(s): 5fa015f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -5
Dockerfile CHANGED
@@ -6,17 +6,23 @@ WORKDIR /app
6
  # Install system dependencies
7
  RUN apt-get update && apt-get install -y espeak-ng
8
 
9
- # Set Hugging Face cache directory to a writable location
10
  ENV HF_HOME="/app/.cache/huggingface"
 
 
 
11
 
12
- # Ensure the cache directory exists and is writable
13
- RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
14
 
15
  # Copy project files
16
  COPY . /app
17
 
18
- # Install Python dependencies
19
- RUN pip install --no-cache-dir -r requirements.txt
 
 
 
20
 
21
  # Run the Flask app
22
  CMD ["python", "app.py"]
 
6
  # Install system dependencies
7
  RUN apt-get update && apt-get install -y espeak-ng
8
 
9
+ # Set writable cache directories
10
  ENV HF_HOME="/app/.cache/huggingface"
11
+ ENV XDG_CACHE_HOME="/app/.cache"
12
+ ENV PIP_CACHE_DIR="/app/.cache/pip"
13
+ ENV TRANSFORMERS_CACHE="/app/.cache/huggingface"
14
 
15
+ # Ensure cache directories exist and have correct permissions
16
+ RUN mkdir -p $HF_HOME $XDG_CACHE_HOME $PIP_CACHE_DIR $TRANSFORMERS_CACHE && chmod -R 777 /app/.cache
17
 
18
  # Copy project files
19
  COPY . /app
20
 
21
+ # Install Python dependencies (use --user to avoid permission errors)
22
+ RUN pip install --no-cache-dir --user -r requirements.txt
23
+
24
+ # Install SpaCy model explicitly under /app to avoid permission issues
25
+ RUN python -m spacy download en-core-web-sm --direct --user
26
 
27
  # Run the Flask app
28
  CMD ["python", "app.py"]