muddasser commited on
Commit
9d6f048
·
verified ·
1 Parent(s): a34cd68

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +0 -13
Dockerfile CHANGED
@@ -1,41 +1,28 @@
1
  FROM python:3.10-slim
2
 
3
- # Avoid interactive prompts
4
  ENV DEBIAN_FRONTEND=noninteractive
5
-
6
- # Set environment variables for EasyOCR and Ultralytics
7
  ENV EASYOCR_MODULE_PATH=/app/.EasyOCR
8
  ENV YOLO_CONFIG_DIR=/app/.config/Ultralytics
9
 
10
- # Install system dependencies
11
  RUN apt-get update && apt-get install -y --no-install-recommends \
12
  git curl build-essential ffmpeg libsm6 libxext6 file \
13
  && apt-get clean && rm -rf /var/lib/apt/lists/*
14
 
15
- # Set work directory
16
  WORKDIR /app
17
 
18
- # Create directories for EasyOCR and Ultralytics with appropriate permissions
19
  RUN mkdir -p /app/.EasyOCR /app/.config/Ultralytics \
20
  && chmod -R 777 /app/.EasyOCR /app/.config/Ultralytics
21
 
22
- # Copy requirements
23
  COPY requirements.txt .
24
-
25
- # Install Python packages
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
- # Download YOLOv8 model weights with validation
29
  RUN curl -L --retry 3 --retry-delay 5 -o /app/anpr_yolov8.pt \
30
  "https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt" \
31
  && [ -s /app/anpr_yolov8.pt ] || { echo "Error: Model download failed or file is empty"; exit 1; } \
32
  && { file /app/anpr_yolov8.pt | grep -q -E "Python|data|gzip" || { echo "Error: anpr_yolov8.pt is not a valid file type"; exit 1; }; }
33
 
34
- # Copy app code
35
  COPY app.py .
36
 
37
- # Expose port for Gradio interface
38
  EXPOSE 7860
39
 
40
- # Run app
41
  CMD ["python", "app.py"]
 
1
  FROM python:3.10-slim
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive
 
 
4
  ENV EASYOCR_MODULE_PATH=/app/.EasyOCR
5
  ENV YOLO_CONFIG_DIR=/app/.config/Ultralytics
6
 
 
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
  git curl build-essential ffmpeg libsm6 libxext6 file \
9
  && apt-get clean && rm -rf /var/lib/apt/lists/*
10
 
 
11
  WORKDIR /app
12
 
 
13
  RUN mkdir -p /app/.EasyOCR /app/.config/Ultralytics \
14
  && chmod -R 777 /app/.EasyOCR /app/.config/Ultralytics
15
 
 
16
  COPY requirements.txt .
 
 
17
  RUN pip install --no-cache-dir -r requirements.txt
18
 
 
19
  RUN curl -L --retry 3 --retry-delay 5 -o /app/anpr_yolov8.pt \
20
  "https://github.com/ultralytics/assets/releases/download/v8.2.0/yolov8n.pt" \
21
  && [ -s /app/anpr_yolov8.pt ] || { echo "Error: Model download failed or file is empty"; exit 1; } \
22
  && { file /app/anpr_yolov8.pt | grep -q -E "Python|data|gzip" || { echo "Error: anpr_yolov8.pt is not a valid file type"; exit 1; }; }
23
 
 
24
  COPY app.py .
25
 
 
26
  EXPOSE 7860
27
 
 
28
  CMD ["python", "app.py"]