vasdevaman6 commited on
Commit
6415d27
·
verified ·
1 Parent(s): 920eb2f
Files changed (1) hide show
  1. Dockerfile +8 -5
Dockerfile CHANGED
@@ -6,28 +6,31 @@ ENV PYTHONUNBUFFERED 1
6
 
7
  # 2. System Dependencies: Install libraries required by OpenCV (cv2) and image processing
8
  # libgl1 and libgomp1 are critical for running TensorFlow/Keras headless (without a display)
 
9
  RUN apt-get update && \
10
  apt-get install -y --no-install-recommends \
11
  libgl1 \
12
  libgomp1 \
 
13
  && apt-get clean && rm -rf /var/lib/apt/lists/*
14
 
15
  # 3. Application Setup
16
  WORKDIR /app
17
 
18
- # Copy the requirements file first (optimizes Docker build speed)
19
  COPY requirements.txt .
20
-
21
- # Install all Python dependencies (Flask, Gunicorn, TensorFlow, OpenCV, etc.)
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
- # Copy the rest of your application code and models (including .pkl, .h5, .py files, and folders)
25
  COPY . .
26
 
 
 
 
 
27
  # 4. Deployment Configuration
28
  # Hugging Face Spaces runs on port 7860 by default
29
  ENV PORT 7860
30
 
31
  # Run the application using Gunicorn (the production web server)
32
- # 'app:app' refers to the 'app' object inside your 'app.py' file
33
  CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 app:app
 
6
 
7
  # 2. System Dependencies: Install libraries required by OpenCV (cv2) and image processing
8
  # libgl1 and libgomp1 are critical for running TensorFlow/Keras headless (without a display)
9
+ # NOTE: Removed build-essential/cmake for speed, using minimal required libs
10
  RUN apt-get update && \
11
  apt-get install -y --no-install-recommends \
12
  libgl1 \
13
  libgomp1 \
14
+ libsm6 libxext6 \
15
  && apt-get clean && rm -rf /var/lib/apt/lists/*
16
 
17
  # 3. Application Setup
18
  WORKDIR /app
19
 
20
+ # 3a. Copy and install dependencies
21
  COPY requirements.txt .
 
 
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
+ # 3b. Copy the rest of your application code and models
25
  COPY . .
26
 
27
+ # 🛑 CRITICAL FIX: Grant write permission to the /app directory.
28
+ # This allows EasyOCR to create the 'easyocr_models' directory and save files without Permission Denied error.
29
+ RUN chmod -R 777 /app
30
+
31
  # 4. Deployment Configuration
32
  # Hugging Face Spaces runs on port 7860 by default
33
  ENV PORT 7860
34
 
35
  # Run the application using Gunicorn (the production web server)
 
36
  CMD exec gunicorn --bind 0.0.0.0:$PORT --workers 1 --threads 8 app:app