PrashanthB461 commited on
Commit
e7a29ac
·
verified ·
1 Parent(s): f8f8eae

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -4
Dockerfile CHANGED
@@ -1,18 +1,19 @@
1
  # Use Python 3.10-slim as base image
2
  FROM python:3.10-slim
3
 
4
- # Install system dependencies for OpenCV and FFmpeg
5
  RUN apt-get update && apt-get install -y \
6
  libgl1-mesa-glx \
7
  libglib2.0-0 \
8
  ffmpeg \
 
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
  # Create a non-root user and set up directories
12
  RUN useradd -m -u 1000 appuser && \
13
- mkdir -p /tmp/Ultralytics /snapshots && \
14
- chown -R appuser:appuser /tmp/Ultralytics /snapshots && \
15
- chmod -R 777 /tmp/Ultralytics /snapshots
16
 
17
  # Set environment variables early
18
  ENV YOLO_CONFIG_DIR=/tmp/Ultralytics
@@ -26,6 +27,11 @@ WORKDIR /app
26
  COPY requirements.txt .
27
  RUN pip install --no-cache-dir -r requirements.txt
28
 
 
 
 
 
 
29
  # Copy application code
30
  COPY . .
31
 
 
1
  # Use Python 3.10-slim as base image
2
  FROM python:3.10-slim
3
 
4
+ # Install system dependencies for OpenCV, FFmpeg, and debugging
5
  RUN apt-get update && apt-get install -y \
6
  libgl1-mesa-glx \
7
  libglib2.0-0 \
8
  ffmpeg \
9
+ curl \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
  # Create a non-root user and set up directories
13
  RUN useradd -m -u 1000 appuser && \
14
+ mkdir -p /tmp/Ultralytics /snapshots /app && \
15
+ chown -R appuser:appuser /tmp/Ultralytics /snapshots /app && \
16
+ chmod -R 777 /tmp/Ultralytics /snapshots /app
17
 
18
  # Set environment variables early
19
  ENV YOLO_CONFIG_DIR=/tmp/Ultralytics
 
27
  COPY requirements.txt .
28
  RUN pip install --no-cache-dir -r requirements.txt
29
 
30
+ # Download YOLOv8n model weights if not present in project directory
31
+ RUN curl -L -o yolov8n.pt https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt && \
32
+ chown appuser:appuser yolov8n.pt && \
33
+ chmod 644 yolov8n.pt
34
+
35
  # Copy application code
36
  COPY . .
37