2023-09-26 17:38:32 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2024-09-12 19:10:30 +00:00
|
|
|
. $(dirname $0)/env.sh
|
2024-03-07 18:54:21 +00:00
|
|
|
|
|
|
|
# Set PUSH to a non-empty string to trigger push instead of load
|
|
|
|
PUSH=${PUSH:-""}
|
|
|
|
|
|
|
|
if [ -z "${PUSH}" ] ; then
|
2024-09-12 19:10:30 +00:00
|
|
|
echo "Building ${FINAL_IMAGE_REPO}:$VERSION locally. set PUSH=1 to push"
|
2024-03-07 18:54:21 +00:00
|
|
|
LOAD_OR_PUSH="--load"
|
|
|
|
else
|
2024-09-12 19:10:30 +00:00
|
|
|
echo "Will be pushing ${FINAL_IMAGE_REPO}:$VERSION"
|
2024-03-07 18:54:21 +00:00
|
|
|
LOAD_OR_PUSH="--push"
|
|
|
|
fi
|
|
|
|
|
2024-09-12 19:10:30 +00:00
|
|
|
docker buildx build \
|
|
|
|
${LOAD_OR_PUSH} \
|
|
|
|
--platform=${PLATFORM} \
|
|
|
|
${OLLAMA_COMMON_BUILD_ARGS} \
|
|
|
|
-f Dockerfile \
|
|
|
|
-t ${FINAL_IMAGE_REPO}:$VERSION \
|
|
|
|
.
|
|
|
|
|
|
|
|
if echo $PLATFORM | grep "amd64" > /dev/null; then
|
|
|
|
docker buildx build \
|
|
|
|
${LOAD_OR_PUSH} \
|
|
|
|
--platform=linux/amd64 \
|
|
|
|
${OLLAMA_COMMON_BUILD_ARGS} \
|
|
|
|
--target runtime-rocm \
|
|
|
|
-f Dockerfile \
|
|
|
|
-t ${FINAL_IMAGE_REPO}:$VERSION-rocm \
|
|
|
|
.
|
|
|
|
fi
|