cd5c8f6471
* Optimize container images for startup This change adjusts how to handle runner payloads to support container builds where we keep them extracted in the filesystem. This makes it easier to optimize the cpu/cuda vs cpu/rocm images for size, and should result in faster startup times for container images. * Refactor payload logic and add buildx support for faster builds * Move payloads around * Review comments * Converge to buildx based helper scripts * Use docker buildx action for release
35 lines
No EOL
810 B
Bash
Executable file
35 lines
No EOL
810 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
. $(dirname $0)/env.sh
|
|
|
|
# Set PUSH to a non-empty string to trigger push instead of load
|
|
PUSH=${PUSH:-""}
|
|
|
|
if [ -z "${PUSH}" ] ; then
|
|
echo "Building ${FINAL_IMAGE_REPO}:$VERSION locally. set PUSH=1 to push"
|
|
LOAD_OR_PUSH="--load"
|
|
else
|
|
echo "Will be pushing ${FINAL_IMAGE_REPO}:$VERSION"
|
|
LOAD_OR_PUSH="--push"
|
|
fi
|
|
|
|
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 |