File size: 834 Bytes
4d28228
9f87a08
1c00921
4d28228
 
 
 
 
 
 
 
 
 
 
1c00921
 
4d28228
1c00921
 
 
 
 
4d28228
1c00921
4d28228
1c00921
 
4d28228
1c00921
 
4d28228
1c00921
4d28228
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Use a base image with CUDA 11.8 and Ubuntu 22.04
FROM nvidia/cuda:11.8.0-devel-ubuntu22.04

# Avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# Install system dependencies for Python, Git, FFmpeg, and OpenCV
RUN apt-get update && apt-get install -y --no-install-recommends \
    python3-pip \
    python3-dev \
    git \
    ffmpeg \
    libgl1-mesa-glx \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Create a non-root user
RUN useradd -m -u 1000 user
USER user
WORKDIR /app
ENV PATH="/home/user/.local/bin:$PATH"

# Copy and install Python requirements
COPY --chown=user requirements.txt .
RUN python3 -m pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application code
COPY --chown=user . /app

# Expose the port and run the app
EXPOSE 7860
CMD ["python3", "app.py"]