Spaces:
Running
on
Zero
Running
on
Zero
| FROM pytorch/pytorch:2.7.1-cuda12.6-cudnn9-devel | |
| ENV CUDA_HOME=/usr/local/cuda | |
| ENV PATH="${CUDA_HOME}/bin:${PATH}" | |
| ENV LD_LIBRARY_PATH="${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}" | |
| ENV TORCH_CUDA_ARCH_LIST="7.5" | |
| ENV USE_CUDA=1 | |
| # Verify CUDA setup | |
| RUN nvcc --version && which nvcc | |
| RUN apt-get update && apt-get install -y \ | |
| git fish tmux curl ffmpeg \ | |
| libgl1-mesa-glx libglib2.0-0 \ | |
| build-essential ninja-build python3.10-venv \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create non-root user | |
| RUN useradd -m -u 1000 user | |
| # Create HF cache with correct ownership | |
| ENV HF_HOME=/home/user/.cache/huggingface | |
| RUN mkdir -p $HF_HOME && chown -R user:user /home/user | |
| ENV OMP_NUM_THREADS=1 | |
| ENV MKL_NUM_THREADS=1 | |
| ENV NUMEXPR_NUM_THREADS=1 | |
| # Switch to user before creating venv | |
| USER user | |
| WORKDIR /home/user/app | |
| # Create virtualenv | |
| RUN python3 -m venv /home/user/venv | |
| ENV PATH="/home/user/venv/bin:$PATH" | |
| # Dependencies | |
| COPY --chown=user:user requirements.txt . | |
| RUN pip install --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Editable installs | |
| RUN pip install --no-cache-dir -e ./src/video-sam2 && \ | |
| pip install --no-cache-dir --use-pep517 -e ./src/GroundingDINO && \ | |
| pip install --no-cache-dir -e ./src/LASER && \ | |
| pip install --no-cache-dir -e ./vine_hf | |
| RUN cd src/GroundingDINO && \ | |
| python3 setup.py build_ext --force --inplace | |
| # Copy app | |
| COPY --chown=user:user . . | |
| EXPOSE 7860 | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| CMD ["python3", "app.py"] |