zyxciss commited on
Commit
c99fdb0
·
verified ·
1 Parent(s): 8f2eff7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -5
Dockerfile CHANGED
@@ -15,14 +15,21 @@ ENV TRANSFORMERS_CACHE="/app/.cache/huggingface"
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 --user
 
 
 
 
 
 
26
 
27
  # Run the Flask app
28
  CMD ["python", "app.py"]
 
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 requirements first to leverage Docker cache
19
+ COPY requirements.txt .
20
 
21
+ # Upgrade pip and install dependencies globally (without --user)
22
+ RUN pip install --no-cache-dir --upgrade pip \
23
+ && pip install --no-cache-dir -r requirements.txt
24
 
25
  # Install SpaCy model explicitly under /app to avoid permission issues
26
+ RUN python -m spacy download en_core_web_sm
27
+
28
+ # Copy project files
29
+ COPY . .
30
+
31
+ # Ensure Flask is installed
32
+ RUN python -m pip show flask
33
 
34
  # Run the Flask app
35
  CMD ["python", "app.py"]