Skip to content

Commit

Permalink
update container build action
Browse files Browse the repository at this point in the history
  • Loading branch information
mostlygeek committed Feb 18, 2025
1 parent f5a2be6 commit 4ed58fb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Containers
on:
# time has no specific meaning, trying to time it after
# the llama.cpp daily packages are published
# /~https://github.com/ggerganov/llama.cpp/blob/master/.github/workflows/docker.yml
# /~https://github.com/ggml-org/llama.cpp/blob/master/.github/workflows/docker.yml
schedule:
- cron: "37 5 * * *"

Expand Down Expand Up @@ -31,4 +31,4 @@ jobs:
- name: Run build-container
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./docker/build-container.sh ${{ matrix.platform }}
run: ./docker/build-container.sh ${{ matrix.platform }} true
13 changes: 9 additions & 4 deletions docker/build-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
cd $(dirname "$0")

ARCH=$1
PUSH_IMAGES=${2:-false}

# List of allowed architectures
ALLOWED_ARCHS=("intel" "vulkan" "musa" "cuda" "cpu")
Expand All @@ -28,17 +29,21 @@ if [ "$ARCH" == "cpu" ]; then
CONTAINER_LATEST="ghcr.io/mostlygeek/llama-swap:cpu"
echo "Building ${CONTAINER_LATEST} $LS_VER"
docker build -f llama-swap.Containerfile --build-arg BASE_TAG=server --build-arg LS_VER=${LS_VER} -t ${CONTAINER_LATEST} .
docker push ${CONTAINER_LATEST}
if [ "$PUSH_IMAGES" == "true" ]; then
docker push ${CONTAINER_LATEST}
fi
else
LCPP_TAG=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/users/ggerganov/packages/container/llama.cpp/versions" \
"https://api.github.com/users/ggml-org/packages/container/llama.cpp/versions" \
| jq -r --arg arch "$ARCH" '.[] | select(.metadata.container.tags[] | startswith("server-\($arch)")) | .metadata.container.tags[]' \
| sort -r | head -n1 | awk -F '-' '{print $3}')

CONTAINER_TAG="ghcr.io/mostlygeek/llama-swap:v${LS_VER}-${ARCH}-${LCPP_TAG}"
CONTAINER_LATEST="ghcr.io/mostlygeek/llama-swap:${ARCH}"
echo "Building ${CONTAINER_TAG} $LS_VER"
docker build -f llama-swap.Containerfile --build-arg BASE_TAG=server-${ARCH}-${LCPP_TAG} --build-arg LS_VER=${LS_VER} -t ${CONTAINER_TAG} -t ${CONTAINER_LATEST} .
docker push ${CONTAINER_TAG}
docker push ${CONTAINER_LATEST}
if [ "$PUSH_IMAGES" == "true" ]; then
docker push ${CONTAINER_TAG}
docker push ${CONTAINER_LATEST}
fi
fi
2 changes: 1 addition & 1 deletion docker/llama-swap.Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_TAG=server-cuda
FROM ghcr.io/ggerganov/llama.cpp:${BASE_TAG}
FROM ghcr.io/ggml-org/llama.cpp:${BASE_TAG}

# has to be after the FROM
ARG LS_VER=89
Expand Down

0 comments on commit 4ed58fb

Please sign in to comment.