Julien Blanchon commited on
Commit
a6aff69
·
1 Parent(s): 9e3c016

Fix uv Docker workflow: copy gsplat before sync, then rebuild

Browse files

- Copy gsplat source before uv sync to resolve dependencies
- Use uv sync to install all dependencies including source gsplat
- Build optimized wheel and force-reinstall it for target GPU architecture
- This ensures GPU compatibility while using proper uv workflow

Files changed (1) hide show
  1. Dockerfile +7 -10
Dockerfile CHANGED
@@ -42,28 +42,25 @@ ENV HOME=/home/user \
42
  GRADIO_SERVER_PORT=7860 \
43
  UV_CACHE_DIR=/home/user/.cache/uv
44
 
45
- # Copy dependency files for layer caching
46
  COPY --chown=user pyproject.docker.toml ./pyproject.toml
 
47
 
48
  # Set CUDA compilation flags for HF Spaces GPU compatibility
49
  ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0" \
50
  FORCE_CUDA=1
51
 
52
- # Install dependencies without the project first (for better caching)
53
  RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
54
- UV_CACHE_DIR=/tmp/uv-cache uv sync --no-install-project --no-dev
55
 
56
- # Copy gsplat source and build wheel for target architecture
57
- COPY --chown=user gsplat/ ./gsplat/
58
  RUN cd gsplat && \
59
  uv run python setup.py bdist_wheel && \
60
  mkdir -p ../wheels && \
61
  cp dist/*.whl ../wheels/ && \
62
- cd ..
63
-
64
- # Install the project with the fresh-built wheel
65
- RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
66
- UV_CACHE_DIR=/tmp/uv-cache uv sync --no-dev
67
 
68
  # Copy the rest of the application
69
  COPY --chown=user . .
 
42
  GRADIO_SERVER_PORT=7860 \
43
  UV_CACHE_DIR=/home/user/.cache/uv
44
 
45
+ # Copy dependency files and gsplat source
46
  COPY --chown=user pyproject.docker.toml ./pyproject.toml
47
+ COPY --chown=user gsplat/ ./gsplat/
48
 
49
  # Set CUDA compilation flags for HF Spaces GPU compatibility
50
  ENV TORCH_CUDA_ARCH_LIST="6.0;6.1;7.0;7.5;8.0;8.6;8.9;9.0" \
51
  FORCE_CUDA=1
52
 
53
+ # Create virtual environment and install dependencies
54
  RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
55
+ UV_CACHE_DIR=/tmp/uv-cache uv sync --no-dev
56
 
57
+ # Build gsplat wheel for target architecture and reinstall it
 
58
  RUN cd gsplat && \
59
  uv run python setup.py bdist_wheel && \
60
  mkdir -p ../wheels && \
61
  cp dist/*.whl ../wheels/ && \
62
+ cd .. && \
63
+ uv pip install wheels/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl --force-reinstall
 
 
 
64
 
65
  # Copy the rest of the application
66
  COPY --chown=user . .