2023-09-26 17:38:32 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2024-01-23 01:12:20 +00:00
|
|
|
export VERSION=${VERSION:-$(git describe --tags --first-parent --abbrev=7 --long --dirty --always | sed -e "s/^v//g")}
|
2023-09-26 17:38:32 +00:00
|
|
|
export GOFLAGS="'-ldflags=-w -s \"-X=github.com/jmorganca/ollama/version.Version=$VERSION\" \"-X=github.com/jmorganca/ollama/server.mode=release\"'"
|
|
|
|
|
2024-02-26 22:00:32 +00:00
|
|
|
IMAGE_NAME=${IMAGE_NAME:-"ollama/ollama"}
|
|
|
|
BUILD_PLATFORM=${BUILD_PLATFORM:-"linux/arm64,linux/amd64"}
|
2024-01-03 00:32:54 +00:00
|
|
|
docker build \
|
2023-09-26 17:38:32 +00:00
|
|
|
--load \
|
2024-02-26 22:00:32 +00:00
|
|
|
--platform=${BUILD_PLATFORM} \
|
2023-09-26 17:38:32 +00:00
|
|
|
--build-arg=VERSION \
|
|
|
|
--build-arg=GOFLAGS \
|
|
|
|
-f Dockerfile \
|
2024-02-26 22:00:32 +00:00
|
|
|
-t ${IMAGE_NAME}:$VERSION \
|
2023-09-26 17:38:32 +00:00
|
|
|
.
|
2024-01-26 00:58:05 +00:00
|
|
|
|
|
|
|
docker build \
|
|
|
|
--load \
|
|
|
|
--platform=linux/amd64 \
|
|
|
|
--build-arg=VERSION \
|
|
|
|
--build-arg=GOFLAGS \
|
|
|
|
--target runtime-rocm \
|
|
|
|
-f Dockerfile \
|
2024-02-26 22:00:32 +00:00
|
|
|
-t ${IMAGE_NAME}:$VERSION-rocm \
|
2024-01-26 00:58:05 +00:00
|
|
|
.
|
2024-02-26 22:00:32 +00:00
|
|
|
|
|
|
|
docker tag ${IMAGE_NAME}:$VERSION ${IMAGE_NAME}:latest
|
|
|
|
docker tag ${IMAGE_NAME}:$VERSION-rocm ${IMAGE_NAME}:rocm
|
|
|
|
|
|
|
|
echo "To release, run:"
|
|
|
|
echo " docker push ${IMAGE_NAME}:$VERSION && docker push ${IMAGE_NAME}:latest"
|
|
|
|
echo " docker push ${IMAGE_NAME}:$VERSION-rocm && docker push ${IMAGE_NAME}:rocm"
|