starvector-gpu / Dockerfile
scott-ashton-tds
Add cache buster ENV to force complete rebuild
d1010a9
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
# System deps
# - libcairo2 is required by cairosvg
# - ninja-build / build-essential are commonly needed for compiling flash-attn
# - libaio-dev and the CUDA compiler are required by some training/inference deps
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
ninja-build \
pkg-config \
libcairo2 \
libcairo2-dev \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender1 \
libaio-dev \
cuda-compiler-12-4 \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Cache buster - change this to force rebuild
ENV CACHE_BUST=2026-02-27-06-46
# Install StarVector from GitHub
# Pin to main branch by default; you can pin a commit for reproducibility.
RUN git clone --depth 1 https://github.com/joanrod/star-vector.git /app/star-vector
# Install python dependencies
# The upstream package depends on flash_attn, which tries to import torch during build.
# Disable build isolation so torch from the base image is visible.
ENV PIP_NO_BUILD_ISOLATION=1
# Install dependencies - don't upgrade setuptools to avoid breaking pkg_resources
RUN pip install --upgrade pip wheel \
# pycairo (pulled in via svglib/rlpycairo) uses meson-python as its PEP517 backend
&& pip install meson meson-python \
&& pip install flash-attn==2.7.3 --no-build-isolation \
&& pip install -e /app/star-vector --no-build-isolation
# Force cache invalidation - update this timestamp to rebuild
RUN echo "Build timestamp: 2026-02-27 06:14:00"
# Copy Space app (updated with torch_dtype fix)
COPY app.py /app/app.py
# Hugging Face Spaces sets PORT; default to 7860 locally.
ENV PORT=7860
EXPOSE 7860
CMD ["python", "/app/app.py"]