Julien Blanchon commited on
Commit
99943dd
·
1 Parent(s): d62394f

Implement optimized Docker deployment with pre-built wheel

Browse files

- Create pyproject.docker.toml for Docker-specific dependencies using pre-built wheel
- Keep pyproject.toml for local development using source gsplat
- Dockerfile downloads gsplat wheel from HF models repo during build
- Add automatic model downloading from blanchon/image-gs-models-utils
- No binary files in git repository - everything downloaded during build
- Much faster Docker builds with pre-compiled CUDA extensions

Files changed (3) hide show
  1. Dockerfile +7 -5
  2. pyproject.docker.toml +47 -0
  3. pyproject.toml +2 -0
Dockerfile CHANGED
@@ -42,15 +42,17 @@ ENV HOME=/home/user \
42
  GRADIO_SERVER_PORT=7860 \
43
  UV_CACHE_DIR=/home/user/.cache/uv
44
 
45
- # Copy dependency files first for better caching
46
- COPY --chown=user pyproject.toml uv.lock ./
47
 
48
- # Copy the pre-built wheels directory
49
- COPY --chown=user wheels/ ./wheels/
 
 
50
 
51
  # Install dependencies with uv (using pre-built wheel - much faster!)
52
  RUN --mount=type=cache,target=/tmp/uv-cache,sharing=locked,uid=1000,gid=1000 \
53
- UV_CACHE_DIR=/tmp/uv-cache uv sync --frozen --no-dev
54
 
55
  # Copy the rest of the application
56
  COPY --chown=user . .
 
42
  GRADIO_SERVER_PORT=7860 \
43
  UV_CACHE_DIR=/home/user/.cache/uv
44
 
45
+ # Copy Docker-specific dependency files
46
+ COPY --chown=user pyproject.docker.toml ./pyproject.toml
47
 
48
+ # Download pre-built gsplat wheel from models repository
49
+ RUN mkdir -p wheels && \
50
+ wget -O wheels/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl \
51
+ "https://huggingface.co/blanchon/image-gs-models-utils/resolve/main/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl"
52
 
53
  # Install dependencies with uv (using pre-built wheel - much faster!)
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
  # Copy the rest of the application
58
  COPY --chown=user . .
pyproject.docker.toml ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [project]
2
+ name = "image-gs"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "lpips>=0.1.4",
9
+ "matplotlib>=3.10.6",
10
+ "numpy>=2.2.6",
11
+ "pytorch-msssim>=1.0.0",
12
+ "scikit-image>=0.25.2",
13
+ "scipy>=1.15.3",
14
+ "torch>=2.6.0",
15
+ "torchmetrics>=1.8.2",
16
+ "torchvision>=0.21.0",
17
+ "fused_ssim",
18
+ "pyyaml>=6.0.2",
19
+ "gsplat",
20
+ "gradio>=4.0.0",
21
+ "huggingface_hub>=0.24.0",
22
+ ]
23
+
24
+ # We use python 3.10 and cu124
25
+ [tool.uv.sources]
26
+ fused_ssim = { git = "https://github.com/rahul-goel/fused-ssim/" }
27
+ gsplat = { path = "wheels/gsplat-0.1.0-cp310-cp310-linux_x86_64.whl" }
28
+ torch = [
29
+ { index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
30
+ ]
31
+ torchvision = [
32
+ { index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
33
+ ]
34
+
35
+
36
+ [tool.uv.extra-build-dependencies]
37
+ fused-ssim = ["torch", "numpy"]
38
+
39
+ [[tool.uv.index]]
40
+ name = "pytorch-cu124"
41
+ url = "https://download.pytorch.org/whl/cu124"
42
+ explicit = true
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "huggingface-hub[cli]>=0.34.4",
47
+ ]
pyproject.toml CHANGED
@@ -24,6 +24,7 @@ dependencies = [
24
  # We use python 3.10 and cu124
25
  [tool.uv.sources]
26
  fused_ssim = { git = "https://github.com/rahul-goel/fused-ssim/" }
 
27
  torch = [
28
  { index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
29
  ]
@@ -34,6 +35,7 @@ torchvision = [
34
 
35
  [tool.uv.extra-build-dependencies]
36
  fused-ssim = ["torch", "numpy"]
 
37
 
38
  [[tool.uv.index]]
39
  name = "pytorch-cu124"
 
24
  # We use python 3.10 and cu124
25
  [tool.uv.sources]
26
  fused_ssim = { git = "https://github.com/rahul-goel/fused-ssim/" }
27
+ gsplat = { path = "gsplat" }
28
  torch = [
29
  { index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
30
  ]
 
35
 
36
  [tool.uv.extra-build-dependencies]
37
  fused-ssim = ["torch", "numpy"]
38
+ gsplat = ["torch", "numpy"]
39
 
40
  [[tool.uv.index]]
41
  name = "pytorch-cu124"