File size: 1,053 Bytes
2cef617
 
f46405f
2cef617
f46405f
 
2cef617
 
 
 
 
 
 
f46405f
 
fc51d33
 
f46405f
2cef617
 
f46405f
 
 
 
 
2cef617
 
 
 
 
 
 
 
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
FROM python:3.12-slim

# System deps (add build-essential + common runtime libs for OpenCV/ONNX)
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential gcc g++ make cmake pkg-config \
    libgl1 libglib2.0-0 libsm6 libxext6 libxrender1 libgomp1 git curl && \
    rm -rf /var/lib/apt/lists/*

# Workspace & writable directories
ENV APP_HOME=/workspace
RUN mkdir -p $APP_HOME/app $APP_HOME/data $APP_HOME/cache && chmod -R 777 $APP_HOME
WORKDIR $APP_HOME

# (Optional but helps some builds)
ENV CC=gcc CXX=g++
ENV INSIGHTFACE_HOME=/workspace/cache/insightface
ENV MPLCONFIGDIR=/workspace/cache/matplotlib

# Python deps
COPY requirements.txt ./requirements.txt

# Pre-install numpy so headers are ready during builds
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir "numpy<2.0; python_version<'3.12'" "numpy>=2.0; python_version>='3.12'" && \
    pip install --no-cache-dir -r requirements.txt

# App
COPY app ./app
COPY run.sh ./run.sh
RUN chmod +x ./run.sh

ENV PORT=7860
CMD ["./run.sh"]