File size: 1,086 Bytes
82551bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0dd2530
 
82551bb
 
 
 
 
 
 
 
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
34
35
36
37
# Small Object Detection — Docker Space
# Match local: Python 3.10, pinned deps (requirements-lock.txt). Gradio on 7860.
FROM python:3.10-slim-bookworm

# System deps: font for draw_label; opencv/ultralytics headless (libxcb, glib, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
    fonts-dejavu-core \
    libglib2.0-0 \
    libxcb1 \
    libxcb-shm0 \
    libxcb-xfixes0 \
    libxrender1 \
    libsm6 \
    libxext6 \
    libgl1-mesa-glx \
    && rm -rf /var/lib/apt/lists/*

# HF Spaces run as user 1000
RUN useradd -m -u 1000 user
ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
USER user

# Install Python deps from lock file so Space matches local versions (no GPU at build time)
COPY --chown=user requirements-lock.txt .
RUN pip install --no-cache-dir --upgrade pip \
    && pip install --no-cache-dir -r requirements-lock.txt \
    && pip uninstall -y accelerate

# App code (refs/ and code)
COPY --chown=user . .

# Gradio must listen on 0.0.0.0 for Docker
ENV GRADIO_SERVER_NAME=0.0.0.0
EXPOSE 7860
CMD ["python", "app.py"]