Spaces:
Sleeping
Sleeping
File size: 894 Bytes
fafbe63 218f5dc fafbe63 218f5dc fafbe63 218f5dc fafbe63 | 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 | FROM python:3.12-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
build-essential \
cmake \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Install uv from the official image
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /app
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install core dependencies first
# We force install torch separately to ensure it is present for detectron2's build
RUN uv sync --frozen --no-dev
# Install detectron2
# Note: --no-build-isolation is often required for detectron2 to find
# the torch installed by uv
# RUN .venv/bin/pip install 'git+https://github.com/facebookresearch/detectron2.git' --no-build-isolation
# Copy the rest of your application code
COPY . .
# Set environment
ENV PATH="/app/.venv/bin:$PATH"
# Run the application
CMD ["python", "app.py"] |