FROM node:22-bookworm-slim AS frontend-build WORKDIR /app/frontend COPY frontend/package*.json ./ RUN npm ci COPY frontend/ ./ RUN npm run build FROM python:3.12-slim AS runtime ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 # Search-only runtime: ffmpeg (thumbnail/video generation) and git (no # git-sourced wheels in requirements-hf) are ingestion-only and dropped to slim # the image. libgomp1 is required by torch; libgl1/libglib2.0-0 are kept for # the optional DeepFace (cv2) face-image path. RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ libgl1 \ libglib2.0-0 \ libgomp1 \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user WORKDIR /app COPY backend/requirements-hf.txt /app/backend/requirements-hf.txt RUN python -m pip install --upgrade pip \ && python -m pip install --index-url https://download.pytorch.org/whl/cpu "torch>=2.6,<3" \ && python -m pip install -r /app/backend/requirements-hf.txt COPY backend /app/backend COPY deploy/huggingface /app/deploy/huggingface COPY --from=frontend-build /app/frontend/dist /app/frontend/dist RUN chmod +x /app/deploy/huggingface/entrypoint.sh \ && mkdir -p /data/search-ui \ && chown -R user:user /app /data USER user ENV HOME=/home/user \ HF_HOME=/data/search-ui/.cache/huggingface \ PORT=7860 \ SEARCH_UI_DATA_ROOT=/data/search-ui \ SEARCH_UI_FRONTEND_DIST=/app/frontend/dist \ SEARCH_UI_CORS_ORIGINS=* \ SEARCH_UI_STRICT_STARTUP=true \ SEARCH_UI_HOSTED_MODE=true EXPOSE 7860 CMD ["/app/deploy/huggingface/entrypoint.sh"]