muddasser commited on
Commit
0904c3a
·
verified ·
1 Parent(s): 5b6c2f8

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -26
Dockerfile CHANGED
@@ -1,41 +1,33 @@
 
1
  FROM python:3.10-slim
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
- ENV PYTHONUNBUFFERED=1
5
 
6
- # Install system dependencies
7
- RUN apt-get update && apt-get install -y \
8
  build-essential \
9
- git \
10
- git-lfs \
11
- ffmpeg \
12
- libsm6 \
13
- libxext6 \
14
  cmake \
15
- rsync \
16
- libgl1 \
17
- libopenblas-dev \
18
- curl \
19
- && rm -rf /var/lib/apt/lists/* \
20
- && git lfs install
21
-
22
- # Create writable dirs for EasyOCR & Ultralytics
23
- RUN mkdir -p /app/.EasyOCR /app/.config/Ultralytics && chmod -R 777 /app
24
 
 
25
  WORKDIR /app
26
 
27
- # Copy requirements and install
28
  COPY requirements.txt .
29
- RUN pip install --no-cache-dir -r requirements.txt
30
 
31
- # Pre-download YOLO model weights
32
- RUN curl -L -o /app/yolov8n.pt https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt
33
 
34
- # Copy application
35
- COPY . .
36
 
37
- # Set environment variables so Ultralytics/EasyOCR store in writable paths
38
- ENV YOLO_CONFIG_DIR=/app/.config/Ultralytics
39
- ENV EASY_OCR_PATH=/app/.EasyOCR
40
 
 
41
  CMD ["python", "app.py"]
 
1
+ # Base image
2
  FROM python:3.10-slim
3
 
4
+ # Prevent interactive prompts during installs
5
  ENV DEBIAN_FRONTEND=noninteractive
 
6
 
7
+ # Install system dependencies (minimal for EasyOCR + Pillow)
8
+ RUN apt-get update && apt-get install -y --no-install-recommends \
9
  build-essential \
 
 
 
 
 
10
  cmake \
11
+ git \
12
+ python3-opencv \
13
+ tesseract-ocr \
14
+ libtesseract-dev \
15
+ && rm -rf /var/lib/apt/lists/*
 
 
 
 
16
 
17
+ # Set work directory
18
  WORKDIR /app
19
 
20
+ # Copy requirements first (to leverage caching)
21
  COPY requirements.txt .
 
22
 
23
+ # Install Python dependencies
24
+ RUN pip install --no-cache-dir -r requirements.txt
25
 
26
+ # Copy app files
27
+ COPY app.py .
28
 
29
+ # Expose port for HF Spaces
30
+ EXPOSE 7860
 
31
 
32
+ # Run app
33
  CMD ["python", "app.py"]