File size: 818 Bytes
cac69cc
b30e7a3
 
 
 
f49470e
 
 
b30e7a3
 
f49470e
b30e7a3
e6b8019
 
 
 
 
 
b30e7a3
 
cac69cc
 
b30e7a3
f49470e
 
 
 
 
b30e7a3
 
 
 
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
FROM python:3.10.7-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

# Create a non-root user with UID 1000
RUN useradd -m -u 1000 user

WORKDIR /app

COPY --chown=user requirements.txt ./
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    wget \
    ca-certificates \
    libgl1 \
    libglib2.0-0 \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/* \
    && pip install --no-cache-dir --upgrade pip \
    && pip install --no-cache-dir -r requirements.txt \
    && python -c "import transformers; print('transformers', transformers.__version__); print('has Sam3Model', hasattr(transformers, 'Sam3Model'))"

COPY --chown=user . .

USER user
ENV HOME=/home/user
ENV PATH=/home/user/.local/bin:$PATH

EXPOSE 7860

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]