replicate / cog

Containers for machine learning
https://cog.run
Apache License 2.0
8.1k stars 564 forks source link

Failing on copying .git directories on image build #2054

Open alexeevit opened 1 week ago

alexeevit commented 1 week ago

Hi, I've got an ComfyUI project (based on fofr/cog-comfyui) with custom_nodes being git submodules. When I'm trying to build the image and push it with separate-weights, it fails.

Here's the full log:

$ cog push --separate-weights r8.im/username/model
Building Docker image from environment in cog.yaml as r8.im/username/model...
⚠ Stripping patch version from Python version 3.10.6 to 3.10
⚠ Stripping patch version from Python version 3.10.6 to 3.10
[+] Building 1.3s (9/9) FINISHED                                                                                                             docker:orbstack
 => [internal] load build definition from Dockerfile                                                                                                    0.0s
 => => transferring dockerfile: 378B                                                                                                                    0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1.4                                                                             0.8s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                                                                        0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.4@sha256:9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc                       0.0s
 => [internal] load .dockerignore                                                                                                                       0.0s
 => => transferring context: 1.32kB                                                                                                                     0.0s
 => [internal] load build context                                                                                                                       0.0s
 => => transferring context: 8.94kB                                                                                                                     0.0s
 => CACHED [1/3] COPY checkpoints /src/checkpoints                                                                                                      0.0s
 => ERROR [2/3] COPY ComfyUI/custom_nodes/ComfyUI-Impact-Pack/.git/objects/pack /src/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/.git/objects/pack         0.0s
 => ERROR [3/3] COPY ComfyUI/custom_nodes/comfyui_controlnet_aux/.git/objects/pack /src/ComfyUI/custom_nodes/comfyui_controlnet_aux/.git/objects/pack   0.0s
------
 > [2/3] COPY ComfyUI/custom_nodes/ComfyUI-Impact-Pack/.git/objects/pack /src/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/.git/objects/pack:
------
------
 > [3/3] COPY ComfyUI/custom_nodes/comfyui_controlnet_aux/.git/objects/pack /src/ComfyUI/custom_nodes/comfyui_controlnet_aux/.git/objects/pack:
------
Dockerfile:6
--------------------
   4 |     COPY checkpoints /src/checkpoints
   5 |     COPY ComfyUI/custom_nodes/ComfyUI-Impact-Pack/.git/objects/pack /src/ComfyUI/custom_nodes/ComfyUI-Impact-Pack/.git/objects/pack
   6 | >>> COPY ComfyUI/custom_nodes/comfyui_controlnet_aux/.git/objects/pack /src/ComfyUI/custom_nodes/comfyui_controlnet_aux/.git/objects/pack
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref 6a73706f-b490-4655-9039-d425601e8e52::si305044bnfz83rhiruyd9q4b: "/ComfyUI/custom_nodes/comfyui_controlnet_aux/.git/objects/pack": not found

TBH I don't even care about it not being able to find the directory, it worries me that it shouldn't copy the .git directories at all, taking into account that both **/.git and .git present in .dockerignore.

$ cog --version
cog version 0.13.0 (built 2024-11-05T18:15:42Z)