File size: 681 Bytes
e0a1fd2
 
 
 
 
 
 
 
 
 
 
 
 
55b8985
 
 
e0a1fd2
 
 
 
55b8985
 
 
e0a1fd2
55b8985
e0a1fd2
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
FROM pytorch/pytorch:2.1.0-cuda12.1-cudnn8-runtime

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \

    libgl1-mesa-glx \
    libglib2.0-0 \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Pre-download models during build
RUN python -c "import torch; torch.hub.load('intel-isl/MiDaS', 'MiDaS_small', trust_repo=True)"

COPY . .

RUN mkdir -p /tmp/video-bg-remover

# Create a non-root user
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app /tmp/video-bg-remover
USER appuser

ENV PORT=7860
CMD uvicorn app:app --host 0.0.0.0 --port $PORT