build_docker.sh 669 Bytes
Newer Older
Michael Yang's avatar
Michael Yang committed
1
2
3
4
#!/bin/sh

set -eu

5
export VERSION=${VERSION:-$(git describe --tags --first-parent --abbrev=7 --long --dirty --always | sed -e "s/^v//g")}
Michael Yang's avatar
Michael Yang committed
6
7
export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"

8
docker build \
Michael Yang's avatar
Michael Yang committed
9
10
11
12
13
    --load \
    --platform=linux/arm64,linux/amd64 \
    --build-arg=VERSION \
    --build-arg=GOFLAGS \
    -f Dockerfile \
14
    -t ollama/ollama:$VERSION \
Michael Yang's avatar
Michael Yang committed
15
    .
16
17
18
19
20
21
22
23
24
25

docker build \
    --load \
    --platform=linux/amd64 \
    --build-arg=VERSION \
    --build-arg=GOFLAGS \
    --target runtime-rocm \
    -f Dockerfile \
    -t ollama/ollama:$VERSION-rocm \
    .