philipobiorah commited on
Commit
b010b3f
·
verified ·
1 Parent(s): 83ddb22

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -1
Dockerfile CHANGED
@@ -11,6 +11,13 @@ RUN apt-get update && apt-get install -y \
11
  libomp-dev \
12
  && rm -rf /var/lib/apt/lists/*
13
 
 
 
 
 
 
 
 
14
  # Copy requirements.txt first to leverage Docker caching
15
  COPY requirements.txt /app/requirements.txt
16
 
@@ -20,9 +27,12 @@ RUN pip install --no-cache-dir -r requirements.txt
20
  # Install PyTorch separately to ensure compatibility with the correct architecture
21
  RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
22
 
23
- # Copy the rest of the application code, including the model file
24
  COPY . /app
25
 
 
 
 
26
  # Expose port 7860 for Hugging Face Spaces
27
  EXPOSE 7860
28
 
 
11
  libomp-dev \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Create writable cache directories within /tmp
15
+ RUN mkdir -p /tmp/transformers_cache /tmp/matplotlib
16
+
17
+ # Set environment variables for Hugging Face Transformers and Matplotlib
18
+ ENV TRANSFORMERS_CACHE=/tmp/transformers_cache
19
+ ENV MPLCONFIGDIR=/tmp/matplotlib
20
+
21
  # Copy requirements.txt first to leverage Docker caching
22
  COPY requirements.txt /app/requirements.txt
23
 
 
27
  # Install PyTorch separately to ensure compatibility with the correct architecture
28
  RUN pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
29
 
30
+ # Copy the rest of the application code, including the local model file
31
  COPY . /app
32
 
33
+ # Ensure that bert_imdb_model.bin exists
34
+ RUN if [ ! -f "/app/bert_imdb_model.bin" ]; then echo "Error: Model file not found in container"; exit 1; fi
35
+
36
  # Expose port 7860 for Hugging Face Spaces
37
  EXPOSE 7860
38