Build and push Docker image #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and push Docker image | |
on: | |
schedule: | |
- cron: '0 5 * * *' # everyday at 5 AM UTC | |
workflow_dispatch: # on demand | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout llama.cpp repository | |
uses: actions/checkout@v4 | |
with: | |
repository: ggerganov/llama.cpp | |
path: llama.cpp | |
fetch-depth: 0 # fetch all history to get tags as well | |
- name: Get current llama.cpp tag | |
id: get_tag | |
working-directory: llama.cpp | |
run: | | |
tag=$(git describe --tags --abbrev=0) || exit $? | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
- name: Checkout my repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU # to support more platforms that amd64 | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- name: Set up Docker Buildx # for cross-platform builds | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push to Docker Hub | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
LLAMA_GIT_TAG=${{ steps.get_tag.outputs.tag }} | |
push: true | |
tags: | | |
${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}:${{ steps.get_tag.outputs.tag }} | |
${{ vars.DOCKERHUB_USERNAME }}/${{ vars.DOCKERHUB_REPOSITORY }}:latest |