amitkumar299 commited on
Commit
9b61d8f
·
verified ·
1 Parent(s): 48e08a4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -8
Dockerfile CHANGED
@@ -1,13 +1,30 @@
1
- FROM python:3.9
 
2
 
3
- RUN useradd -m -u 1000 user
4
- USER user
5
- ENV PATH="/home/user/.local/bin:$PATH"
 
 
 
 
 
6
 
 
7
  WORKDIR /app
8
 
9
- COPY --chown=user ./requirements.txt requirements.txt
10
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
11
 
12
- COPY --chown=user . /app
13
- CMD ["ginicorn", "main:app", "-b", "0.0.0.0:7860"]
 
 
 
 
 
 
 
 
 
 
1
+ # Use a slim Python base image
2
+ FROM python:3.9-slim
3
 
4
+ # Install system dependencies for OpenCV
5
+ RUN apt-get update && apt-get install -y \
6
+ libgl1-mesa-glx \
7
+ libglib2.0-0 \
8
+ ffmpeg \
9
+ libsm6 \
10
+ libxext6 \
11
+ git
12
 
13
+ # Set the working directory
14
  WORKDIR /app
15
 
16
+ # Copy the requirements file and install dependencies
17
+ COPY requirements.txt .
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Copy your application code
21
+ COPY . .
22
+
23
+ # Download the YOLOv8 model (alternatively, ensure it's copied with your app)
24
+ RUN python -c "from ultralytics import YOLO; YOLO('yolov8n.pt')"
25
+
26
+ # Expose the port Hugging Face Spaces expects
27
+ EXPOSE 7860
28
+
29
+ # Command to run your Flask app with Gunicorn
30
+ CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]