[GH-ISSUE #551] Dockerfile.cuda fails to build server #254

Closed
opened 2026-04-12 09:46:45 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @jamesbraza on GitHub (Sep 18, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/551

On an AWS EC2 g4dn.2xlarge instance with Ollama c345053a8b:

> sudo docker buildx build . --file Dockerfile.cuda
[+] Building 57.2s (7/16)                                                                                                                                                                            docker:default
 => => transferring context: 97B                                                                                                                                                                               0.0s
[+] Building 57.3s (7/16)                                                                                                                                                                            docker:default
 => => transferring dockerfile: 939B                                                                                                                                                                           0.0s
[+] Building 113.7s (15/16)                                                                                                                                                                          docker:default
 => [internal] load .dockerignore                                                                                                                                                                              0.0s
 => => transferring context: 97B                                                                                                                                                                               0.0s
 => [internal] load build definition from Dockerfile.cuda                                                                                                                                                      0.0s
 => => transferring dockerfile: 939B                                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-runtime-ubuntu22.04                                                                                                                              1.0s
 => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04                                                                                                                                0.9s
 => [stage-0 1/7] FROM docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04@sha256:0e2d7e252847c334b056937e533683556926f5343a472b6b92f858a7af8ab880                                                                 71.6s
...
 => [stage-1 2/3] RUN groupadd ollama && useradd -m -g ollama ollama                                                                                                                                          20.6s
 => [stage-0 2/7] WORKDIR /go/src/github.com/jmorganca/ollama                                                                                                                                                 21.0s
 => [stage-0 3/7] RUN apt-get update && apt-get install -y git build-essential cmake                                                                                                                          13.5s
 => [stage-0 4/7] ADD https://dl.google.com/go/go1.21.1.linux-amd64.tar.gz /tmp/go1.21.1.tar.gz                                                                                                                0.4s
 => [stage-0 5/7] RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.1.tar.gz                                                                                                                        3.2s
 => [stage-0 6/7] COPY . .                                                                                                                                                                                     0.0s
 => ERROR [stage-0 7/7] RUN /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X=  2.9s
------
 > [stage-0 7/7] RUN /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X=github.com/jmorganca/ollama/server.mode=release" .:
0.377 go: downloading github.com/mattn/go-runewidth v0.0.14
0.377 go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
0.378 go: downloading golang.org/x/term v0.10.0
0.385 go: downloading gonum.org/v1/gonum v0.13.0
0.388 go: downloading github.com/chzyer/readline v1.5.1
0.388 go: downloading golang.org/x/crypto v0.10.0
0.391 go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
0.391 go: downloading github.com/dustin/go-humanize v1.0.1
0.478 go: downloading github.com/gin-contrib/cors v1.4.0
0.480 go: downloading github.com/olekukonko/tablewriter v0.0.5
0.483 go: downloading github.com/gin-gonic/gin v1.9.1
0.486 go: downloading github.com/spf13/cobra v1.7.0
0.487 go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
0.565 go: downloading golang.org/x/sys v0.11.0
0.566 go: downloading github.com/rivo/uniseg v0.2.0
0.573 go: downloading github.com/spf13/pflag v1.0.5
0.580 go: downloading github.com/gin-contrib/sse v0.1.0
0.580 go: downloading github.com/mattn/go-isatty v0.0.19
0.597 go: downloading golang.org/x/net v0.10.0
0.624 go: downloading github.com/go-playground/validator/v10 v10.14.0
0.624 go: downloading github.com/pelletier/go-toml/v2 v2.0.8
0.651 go: downloading github.com/ugorji/go/codec v1.2.11
0.700 go: downloading google.golang.org/protobuf v1.30.0
0.707 go: downloading gopkg.in/yaml.v3 v3.0.1
0.741 go: downloading github.com/gabriel-vasile/mimetype v1.4.2
0.742 go: downloading github.com/go-playground/universal-translator v0.18.1
0.745 go: downloading github.com/leodido/go-urn v1.2.4
0.778 go: downloading golang.org/x/text v0.10.0
0.841 go: downloading github.com/go-playground/locales v0.14.1
1.894 fatal: not a git repository: /go/src/github.com/jmorganca/ollama/../.git/modules/ollama
1.895 llm/llama.cpp/generate.go:6: running "git": exit status 128
------
Dockerfile.cuda:13
--------------------
  12 |     ENV GOARCH=$TARGETARCH
  13 | >>> RUN /usr/local/go/bin/go generate ./... \
  14 | >>>     && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release" .
  15 |
--------------------
ERROR: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build -ldflags \"-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release\" ." did not complete successfully: exit code: 1

Line 13 fails with:

ERROR: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build -ldflags \"-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release\" ." did not complete successfully: exit code: 1

Any idea what's going on here?

Originally created by @jamesbraza on GitHub (Sep 18, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/551 On an AWS EC2 `g4dn.2xlarge` instance with Ollama https://github.com/jmorganca/ollama/tree/c345053a8bf47d5ef8f1fe15d385108059209fba: ```none > sudo docker buildx build . --file Dockerfile.cuda [+] Building 57.2s (7/16) docker:default => => transferring context: 97B 0.0s [+] Building 57.3s (7/16) docker:default => => transferring dockerfile: 939B 0.0s [+] Building 113.7s (15/16) docker:default => [internal] load .dockerignore 0.0s => => transferring context: 97B 0.0s => [internal] load build definition from Dockerfile.cuda 0.0s => => transferring dockerfile: 939B 0.0s => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-runtime-ubuntu22.04 1.0s => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04 0.9s => [stage-0 1/7] FROM docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04@sha256:0e2d7e252847c334b056937e533683556926f5343a472b6b92f858a7af8ab880 71.6s ... => [stage-1 2/3] RUN groupadd ollama && useradd -m -g ollama ollama 20.6s => [stage-0 2/7] WORKDIR /go/src/github.com/jmorganca/ollama 21.0s => [stage-0 3/7] RUN apt-get update && apt-get install -y git build-essential cmake 13.5s => [stage-0 4/7] ADD https://dl.google.com/go/go1.21.1.linux-amd64.tar.gz /tmp/go1.21.1.tar.gz 0.4s => [stage-0 5/7] RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.1.tar.gz 3.2s => [stage-0 6/7] COPY . . 0.0s => ERROR [stage-0 7/7] RUN /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X= 2.9s ------ > [stage-0 7/7] RUN /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X=github.com/jmorganca/ollama/server.mode=release" .: 0.377 go: downloading github.com/mattn/go-runewidth v0.0.14 0.377 go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db 0.378 go: downloading golang.org/x/term v0.10.0 0.385 go: downloading gonum.org/v1/gonum v0.13.0 0.388 go: downloading github.com/chzyer/readline v1.5.1 0.388 go: downloading golang.org/x/crypto v0.10.0 0.391 go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 0.391 go: downloading github.com/dustin/go-humanize v1.0.1 0.478 go: downloading github.com/gin-contrib/cors v1.4.0 0.480 go: downloading github.com/olekukonko/tablewriter v0.0.5 0.483 go: downloading github.com/gin-gonic/gin v1.9.1 0.486 go: downloading github.com/spf13/cobra v1.7.0 0.487 go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 0.565 go: downloading golang.org/x/sys v0.11.0 0.566 go: downloading github.com/rivo/uniseg v0.2.0 0.573 go: downloading github.com/spf13/pflag v1.0.5 0.580 go: downloading github.com/gin-contrib/sse v0.1.0 0.580 go: downloading github.com/mattn/go-isatty v0.0.19 0.597 go: downloading golang.org/x/net v0.10.0 0.624 go: downloading github.com/go-playground/validator/v10 v10.14.0 0.624 go: downloading github.com/pelletier/go-toml/v2 v2.0.8 0.651 go: downloading github.com/ugorji/go/codec v1.2.11 0.700 go: downloading google.golang.org/protobuf v1.30.0 0.707 go: downloading gopkg.in/yaml.v3 v3.0.1 0.741 go: downloading github.com/gabriel-vasile/mimetype v1.4.2 0.742 go: downloading github.com/go-playground/universal-translator v0.18.1 0.745 go: downloading github.com/leodido/go-urn v1.2.4 0.778 go: downloading golang.org/x/text v0.10.0 0.841 go: downloading github.com/go-playground/locales v0.14.1 1.894 fatal: not a git repository: /go/src/github.com/jmorganca/ollama/../.git/modules/ollama 1.895 llm/llama.cpp/generate.go:6: running "git": exit status 128 ------ Dockerfile.cuda:13 -------------------- 12 | ENV GOARCH=$TARGETARCH 13 | >>> RUN /usr/local/go/bin/go generate ./... \ 14 | >>> && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release" . 15 | -------------------- ERROR: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build -ldflags \"-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release\" ." did not complete successfully: exit code: 1 ``` [Line 13](https://github.com/jmorganca/ollama/blob/c345053a8bf47d5ef8f1fe15d385108059209fba/Dockerfile.cuda#L13) fails with: ``` ERROR: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build -ldflags \"-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release\" ." did not complete successfully: exit code: 1 ``` Any idea what's going on here?
Author
Owner

@mxyng commented on GitHub (Sep 21, 2023):

For some reason, git is looking for modules in the wrong place:

1.894 fatal: not a git repository: /go/src/github.com/jmorganca/ollama/../.git/modules/ollama

I tried the same commit without any issues albeit on MacOS.

<!-- gh-comment-id:1730507676 --> @mxyng commented on GitHub (Sep 21, 2023): For some reason, git is looking for modules in the wrong place: ``` 1.894 fatal: not a git repository: /go/src/github.com/jmorganca/ollama/../.git/modules/ollama ``` I tried the same commit without any issues albeit on MacOS.
Author
Owner

@jamesbraza commented on GitHub (Sep 22, 2023):

I have ollama as a git submodule at repo/ollama:

[submodule "ollama"]
	path = ollama
	url = git@github.com:jmorganca/ollama.git

However, I was cd'd into the submodule when running docker buildx build.

Do you think git submodule would affect things? git submodules still have .git

Also, where is command ../.git/modules/ollama located? I don't see it inside the Dockerfile.cuda

<!-- gh-comment-id:1730513800 --> @jamesbraza commented on GitHub (Sep 22, 2023): I have ollama as a `git submodule` at `repo/ollama`: ```none [submodule "ollama"] path = ollama url = git@github.com:jmorganca/ollama.git ``` However, I was `cd`'d into the submodule when running `docker buildx build`. Do you think `git submodule` would affect things? `git submodules` still have `.git` Also, where is command `../.git/modules/ollama` located? I don't see it inside the `Dockerfile.cuda`
Author
Owner

@mxyng commented on GitHub (Sep 22, 2023):

Do you think git submodule would affect things?

Yes because the .git directory in ollama is a reference to the superproject's .git directory:

I created a git repo tmp with ollama as a submodule

$ mkdir tmp
$ cd tmp
$ git init
$ git submodule add https://github.com/jmorganca/ollama.git ollama
$ git submodule init
$ git submodule update

If you open ollama/.git, it refers to the parent directory, which isn't in the docker context:

$ cat ollama/.git
gitdir: ../.git/modules/ollama

I was able to reproduce your issue with this setup:

$ docker build -f Dockerfile.cuda .
[+] Building 29.7s (14/16)                                                                                                                                                                                                                                                                                                                             docker:desktop-linux
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                      0.0s
 => => transferring context: 97B                                                                                                                                                                                                                                                                                                                                       0.0s
 => [internal] load build definition from Dockerfile.cuda                                                                                                                                                                                                                                                                                                              0.0s
 => => transferring dockerfile: 939B                                                                                                                                                                                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-runtime-ubuntu22.04                                                                                                                                                                                                                                                                                      1.0s
 => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04                                                                                                                                                                                                                                                                                        0.0s
 => CACHED [stage-0 1/7] FROM docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04                                                                                                                                                                                                                                                                                           0.0s
 => https://dl.google.com/go/go1.21.1.linux-arm64.tar.gz                                                                                                                                                                                                                                                                                                               4.4s
 => [stage-1 1/3] FROM docker.io/nvidia/cuda:12.2.0-runtime-ubuntu22.04@sha256:0f4f33b31222af3e4d66aea2af0a04368a44160af815b6ae7bfe36f5b536ab99                                                                                                                                                                                                                        0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                                                                      0.1s
 => => transferring context: 1.30MB                                                                                                                                                                                                                                                                                                                                    0.0s
 => [stage-0 2/7] WORKDIR /go/src/github.com/jmorganca/ollama                                                                                                                                                                                                                                                                                                          0.1s
 => [stage-0 3/7] RUN apt-get update && apt-get install -y git build-essential cmake                                                                                                                                                                                                                                                                                  15.9s
 => [stage-0 4/7] ADD https://dl.google.com/go/go1.21.1.linux-arm64.tar.gz /tmp/go1.21.1.tar.gz                                                                                                                                                                                                                                                                        0.2s
 => [stage-0 5/7] RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.1.tar.gz                                                                                                                                                                                                                                                                                2.3s
 => [stage-0 6/7] COPY . .                                                                                                                                                                                                                                                                                                                                             0.0s
 => ERROR [stage-0 7/7] RUN /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X=github.com/jmorganca/ollama/server.mode=release" .                                                                                                        5.6s
------
 > [stage-0 7/7] RUN /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X=github.com/jmorganca/ollama/server.mode=release" .:
0.145 go: downloading golang.org/x/crypto v0.10.0
0.153 go: downloading github.com/mattn/go-runewidth v0.0.14
0.155 go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
0.174 go: downloading golang.org/x/term v0.10.0
0.765 go: downloading github.com/chzyer/readline v1.5.1
0.766 go: downloading github.com/dustin/go-humanize v1.0.1
0.806 go: downloading github.com/olekukonko/tablewriter v0.0.5
0.910 go: downloading github.com/spf13/cobra v1.7.0
0.928 go: downloading github.com/gin-contrib/cors v1.4.0
0.944 go: downloading github.com/gin-gonic/gin v1.9.1
0.999 go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63
1.059 go: downloading gonum.org/v1/gonum v0.13.0
1.113 go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58
1.171 go: downloading github.com/rivo/uniseg v0.2.0
1.331 go: downloading golang.org/x/sys v0.11.0
1.393 go: downloading github.com/spf13/pflag v1.0.5
1.397 go: downloading github.com/gin-contrib/sse v0.1.0
1.545 go: downloading github.com/mattn/go-isatty v0.0.19
1.556 go: downloading golang.org/x/net v0.10.0
1.765 go: downloading github.com/go-playground/validator/v10 v10.14.0
1.807 go: downloading github.com/pelletier/go-toml/v2 v2.0.8
1.854 go: downloading github.com/ugorji/go/codec v1.2.11
1.854 go: downloading google.golang.org/protobuf v1.30.0
1.950 go: downloading gopkg.in/yaml.v3 v3.0.1
2.009 go: downloading github.com/gabriel-vasile/mimetype v1.4.2
2.014 go: downloading github.com/go-playground/universal-translator v0.18.1
2.092 go: downloading github.com/leodido/go-urn v1.2.4
2.154 go: downloading golang.org/x/text v0.10.0
2.871 go: downloading github.com/go-playground/locales v0.14.1
5.364 fatal: not a git repository: /go/src/github.com/jmorganca/ollama/../.git/modules/ollama
5.366 llm/llama.cpp/generate_linux.go:3: running "git": exit status 128
------
Dockerfile.cuda:13
--------------------
  12 |     ENV GOARCH=$TARGETARCH
  13 | >>> RUN /usr/local/go/bin/go generate ./... \
  14 | >>>     && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release" .
  15 |
--------------------
ERROR: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./...     && /usr/local/go/bin/go build -ldflags \"-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release\" ." did not complete successfully: exit code: 1

I would suggest unless there's a really good reason you require submodules to avoid them. Ollama uses it because it needs to build and embed artifacts from another repo (llama.cpp)

<!-- gh-comment-id:1730521494 --> @mxyng commented on GitHub (Sep 22, 2023): > Do you think git submodule would affect things? Yes because the `.git` directory in ollama is a reference to the superproject's `.git` directory: I created a git repo `tmp` with ollama as a submodule ``` $ mkdir tmp $ cd tmp $ git init $ git submodule add https://github.com/jmorganca/ollama.git ollama $ git submodule init $ git submodule update ``` If you open `ollama/.git`, it refers to the parent directory, which isn't in the docker context: ``` $ cat ollama/.git gitdir: ../.git/modules/ollama ``` I was able to reproduce your issue with this setup: ``` $ docker build -f Dockerfile.cuda . [+] Building 29.7s (14/16) docker:desktop-linux => [internal] load .dockerignore 0.0s => => transferring context: 97B 0.0s => [internal] load build definition from Dockerfile.cuda 0.0s => => transferring dockerfile: 939B 0.0s => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-runtime-ubuntu22.04 1.0s => [internal] load metadata for docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04 0.0s => CACHED [stage-0 1/7] FROM docker.io/nvidia/cuda:12.2.0-devel-ubuntu22.04 0.0s => https://dl.google.com/go/go1.21.1.linux-arm64.tar.gz 4.4s => [stage-1 1/3] FROM docker.io/nvidia/cuda:12.2.0-runtime-ubuntu22.04@sha256:0f4f33b31222af3e4d66aea2af0a04368a44160af815b6ae7bfe36f5b536ab99 0.0s => [internal] load build context 0.1s => => transferring context: 1.30MB 0.0s => [stage-0 2/7] WORKDIR /go/src/github.com/jmorganca/ollama 0.1s => [stage-0 3/7] RUN apt-get update && apt-get install -y git build-essential cmake 15.9s => [stage-0 4/7] ADD https://dl.google.com/go/go1.21.1.linux-arm64.tar.gz /tmp/go1.21.1.tar.gz 0.2s => [stage-0 5/7] RUN mkdir -p /usr/local && tar xz -C /usr/local </tmp/go1.21.1.tar.gz 2.3s => [stage-0 6/7] COPY . . 0.0s => ERROR [stage-0 7/7] RUN /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X=github.com/jmorganca/ollama/server.mode=release" . 5.6s ------ > [stage-0 7/7] RUN /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=0.0.0 -X=github.com/jmorganca/ollama/server.mode=release" .: 0.145 go: downloading golang.org/x/crypto v0.10.0 0.153 go: downloading github.com/mattn/go-runewidth v0.0.14 0.155 go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db 0.174 go: downloading golang.org/x/term v0.10.0 0.765 go: downloading github.com/chzyer/readline v1.5.1 0.766 go: downloading github.com/dustin/go-humanize v1.0.1 0.806 go: downloading github.com/olekukonko/tablewriter v0.0.5 0.910 go: downloading github.com/spf13/cobra v1.7.0 0.928 go: downloading github.com/gin-contrib/cors v1.4.0 0.944 go: downloading github.com/gin-gonic/gin v1.9.1 0.999 go: downloading golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 1.059 go: downloading gonum.org/v1/gonum v0.13.0 1.113 go: downloading github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 1.171 go: downloading github.com/rivo/uniseg v0.2.0 1.331 go: downloading golang.org/x/sys v0.11.0 1.393 go: downloading github.com/spf13/pflag v1.0.5 1.397 go: downloading github.com/gin-contrib/sse v0.1.0 1.545 go: downloading github.com/mattn/go-isatty v0.0.19 1.556 go: downloading golang.org/x/net v0.10.0 1.765 go: downloading github.com/go-playground/validator/v10 v10.14.0 1.807 go: downloading github.com/pelletier/go-toml/v2 v2.0.8 1.854 go: downloading github.com/ugorji/go/codec v1.2.11 1.854 go: downloading google.golang.org/protobuf v1.30.0 1.950 go: downloading gopkg.in/yaml.v3 v3.0.1 2.009 go: downloading github.com/gabriel-vasile/mimetype v1.4.2 2.014 go: downloading github.com/go-playground/universal-translator v0.18.1 2.092 go: downloading github.com/leodido/go-urn v1.2.4 2.154 go: downloading golang.org/x/text v0.10.0 2.871 go: downloading github.com/go-playground/locales v0.14.1 5.364 fatal: not a git repository: /go/src/github.com/jmorganca/ollama/../.git/modules/ollama 5.366 llm/llama.cpp/generate_linux.go:3: running "git": exit status 128 ------ Dockerfile.cuda:13 -------------------- 12 | ENV GOARCH=$TARGETARCH 13 | >>> RUN /usr/local/go/bin/go generate ./... \ 14 | >>> && /usr/local/go/bin/go build -ldflags "-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release" . 15 | -------------------- ERROR: failed to solve: process "/bin/sh -c /usr/local/go/bin/go generate ./... && /usr/local/go/bin/go build -ldflags \"-linkmode=external -extldflags='-static' -X=github.com/jmorganca/ollama/version.Version=$VERSION -X=github.com/jmorganca/ollama/server.mode=release\" ." did not complete successfully: exit code: 1 ``` I would suggest unless there's a really good reason you require submodules to avoid them. Ollama uses it because it needs to build and embed artifacts from another repo (llama.cpp)
Author
Owner

@jamesbraza commented on GitHub (Sep 22, 2023):

Good investigating that .git in a git submodule is actually a file, not a directory. That's news to me!

What's interesting is building Ollama server on my macOS (same git submodule structure) works fine. I guess it's some specifics of the Dockerfile.cuda

<!-- gh-comment-id:1730533573 --> @jamesbraza commented on GitHub (Sep 22, 2023): Good investigating that `.git` in a `git submodule` is actually a file, not a directory. That's news to me! What's interesting is building Ollama server on my macOS (same `git submodule` structure) works fine. I guess it's some specifics of the `Dockerfile.cuda`
Author
Owner

@jamesbraza commented on GitHub (Sep 22, 2023):

I am guessing it's not worth the complexity to add traversal of .git symlink-like stuff, so feel free to close this out.

Are there plans for Ollama to publish to Docker hub? Then I could just skip the local building entirely

<!-- gh-comment-id:1730535066 --> @jamesbraza commented on GitHub (Sep 22, 2023): I am guessing it's not worth the complexity to add traversal of `.git` symlink-like stuff, so feel free to close this out. Are there plans for Ollama to publish to Docker hub? Then I could just skip the local building entirely
Author
Owner

@mxyng commented on GitHub (Sep 22, 2023):

This is specific to Docker build for two related reasons, the COPY and the build context.

The build context constrains build to . which in this case is the ollama submodule while COPY only copies everything in the context. This means git inside the Docker build can't follow the link to its parent directory.

Are there plans for Ollama to publish to Docker hub? Then I could just skip the local building entirely

Absolutely. A GPU-less image is already available in Docker Hub under ollama/ollama. Once Linux GPU is out the door, the next step is Docker GPU

<!-- gh-comment-id:1730559786 --> @mxyng commented on GitHub (Sep 22, 2023): This is specific to Docker build for two related reasons, the `COPY` and the build context. The build context constrains build to `.` which in this case is the ollama submodule while `COPY` only copies everything in the context. This means git inside the Docker build can't follow the link to its parent directory. > Are there plans for Ollama to publish to Docker hub? Then I could just skip the local building entirely Absolutely. A GPU-less image is already available in Docker Hub under [ollama/ollama](https://hub.docker.com/r/ollama/ollama). Once Linux GPU is out the door, the next step is Docker GPU
Author
Owner

@jamesbraza commented on GitHub (Sep 22, 2023):

This means git inside the Docker build can't follow the link to its parent directory.

Ah okay, gotchu. Sounds good on future Docker support (and for me, more desirably is docker compose with Docker hub images).

Appreciate your hard work here! Not sure if you want to make any changes here, otherwise feel free to close with the resolution of not docker building within git submodules.

<!-- gh-comment-id:1730585119 --> @jamesbraza commented on GitHub (Sep 22, 2023): > This means git inside the Docker build can't follow the link to its parent directory. Ah okay, gotchu. Sounds good on future Docker support (and for me, more desirably is `docker compose` with Docker hub images). Appreciate your hard work here! Not sure if you want to make any changes here, otherwise feel free to close with the resolution of not `docker build`ing within `git submodule`s.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#254