sksameermujahid commited on
Commit
6b4e079
·
verified ·
1 Parent(s): 8b75d06

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +68 -70
Dockerfile CHANGED
@@ -1,71 +1,69 @@
1
- # Use Python 3.10 slim image for smaller size
2
- FROM python:3.10-slim
3
-
4
- # Set working directory
5
- WORKDIR /app
6
-
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y \
9
- gcc \
10
- g++ \
11
- libgl1-mesa-glx \
12
- libglib2.0-0 \
13
- libsm6 \
14
- libxext6 \
15
- libxrender-dev \
16
- libgomp1 \
17
- libgthread-2.0-0 \
18
- libfontconfig1 \
19
- libgtk-3-0 \
20
- libavcodec-dev \
21
- libavformat-dev \
22
- libswscale-dev \
23
- libv4l-dev \
24
- libxvidcore-dev \
25
- libx264-dev \
26
- libjpeg-dev \
27
- libpng-dev \
28
- libtiff-dev \
29
- libatlas-base-dev \
30
- libhdf5-dev \
31
- libhdf5-serial-dev \
32
- libhdf5-103 \
33
- libqtgui4 \
34
- libqtwebkit4 \
35
- libqt4-test \
36
- python3-dev \
37
- python3-pip \
38
- python3-setuptools \
39
- python3-wheel \
40
- && rm -rf /var/lib/apt/lists/*
41
-
42
- # Copy requirements first for better caching
43
- COPY requirements.txt .
44
-
45
- # Install Python dependencies
46
- RUN pip install --no-cache-dir -r requirements.txt
47
-
48
- # Copy application files
49
- COPY . .
50
-
51
- # Create necessary directories
52
- RUN mkdir -p uploads property_images
53
-
54
- # Download YOLO model
55
- RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
56
-
57
- # Set environment variables
58
- ENV PYTHONPATH=/app
59
- ENV FLASK_APP=app.py
60
- ENV FLASK_ENV=production
61
- ENV PORT=7860
62
-
63
- # Expose port
64
- EXPOSE 7860
65
-
66
- # Health check
67
- HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
68
- CMD curl -f http://localhost:7860/health || exit 1
69
-
70
- # Run the application
71
  CMD ["python", "app.py"]
 
1
+ # Use Python 3.10 slim image for smaller size
2
+ FROM python:3.10-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ gcc \
10
+ g++ \
11
+ libgl1-mesa-glx \
12
+ libglib2.0-0 \
13
+ libsm6 \
14
+ libxext6 \
15
+ libxrender-dev \
16
+ libgomp1 \
17
+ libglib2.0-0 \
18
+ libfontconfig1 \
19
+ libgtk-3-0 \
20
+ libavcodec-dev \
21
+ libavformat-dev \
22
+ libswscale-dev \
23
+ libv4l-dev \
24
+ libxvidcore-dev \
25
+ libx264-dev \
26
+ libjpeg-dev \
27
+ libpng-dev \
28
+ libtiff-dev \
29
+ libatlas-base-dev \
30
+ libhdf5-dev \
31
+ libhdf5-serial-dev \
32
+ libhdf5-103 \
33
+ python3-dev \
34
+ python3-pip \
35
+ python3-setuptools \
36
+ python3-wheel \
37
+ curl \
38
+ && rm -rf /var/lib/apt/lists/*
39
+
40
+ # Copy requirements first for better caching
41
+ COPY requirements.txt .
42
+
43
+ # Install Python dependencies
44
+ RUN pip install --no-cache-dir -r requirements.txt
45
+
46
+ # Copy application files
47
+ COPY . .
48
+
49
+ # Create necessary directories
50
+ RUN mkdir -p uploads property_images
51
+
52
+ # Download YOLO model
53
+ RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
54
+
55
+ # Set environment variables
56
+ ENV PYTHONPATH=/app
57
+ ENV FLASK_APP=app.py
58
+ ENV FLASK_ENV=production
59
+ ENV PORT=7860
60
+
61
+ # Expose port
62
+ EXPOSE 7860
63
+
64
+ # Health check
65
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
66
+ CMD curl -f http://localhost:7860/health || exit 1
67
+
68
+ # Run the application
 
 
69
  CMD ["python", "app.py"]