Team Ai
Apppublic

KBaba7/llama.cpp

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
0likes
docker.yml174 linesDownload Raw Back to workflows
1# This workflow uses actions that are not certified by GitHub.2# They are provided by a third-party and are governed by3# separate terms of service, privacy policy, and support4# documentation.5 6# GitHub recommends pinning actions to a commit SHA.7# To get a newer version, you will need to update the SHA.8# You can also reference a tag or branch, but the action may change without warning.9 10name: Publish Docker image11 12on:13  workflow_dispatch: # allows manual triggering14  schedule:15    # Rebuild daily rather than on every push because it is expensive16    - cron: '12 4 * * *'17 18concurrency:19  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}20  cancel-in-progress: true21 22# Fine-grant permission23# https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token24permissions:25  packages: write26 27jobs:28  push_to_registry:29    name: Push Docker image to Docker Hub30 31    runs-on: ubuntu-22.0432    env:33      COMMIT_SHA: ${{ github.sha }}34    strategy:35      fail-fast: false36      matrix:37        config:38          # Multi-stage build39          - { tag: "cpu", dockerfile: ".devops/cpu.Dockerfile", platforms: "linux/amd64,linux/arm64", full: true, light: true, server: true, freediskspace: false}40          - { tag: "cuda", dockerfile: ".devops/cuda.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, freediskspace: false}41          - { tag: "musa", dockerfile: ".devops/musa.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, freediskspace: false}42          - { tag: "intel", dockerfile: ".devops/intel.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, freediskspace: false}43          - { tag: "vulkan", dockerfile: ".devops/vulkan.Dockerfile", platforms: "linux/amd64", full: true, light: true, server: true, freediskspace: false}44          # Note: the rocm images are failing due to a compiler error and are disabled until this is fixed to allow the workflow to complete45          #- {tag: "rocm", dockerfile: ".devops/rocm.Dockerfile", platforms: "linux/amd64,linux/arm64", full: true, light: true, server: true, freediskspace: true }46    steps:47      - name: Check out the repo48        uses: actions/checkout@v449        with:50          fetch-depth: 0 # preserve git history, so we can determine the build number51 52      - name: Set up QEMU53        uses: docker/setup-qemu-action@v354 55      - name: Set up Docker Buildx56        uses: docker/setup-buildx-action@v357 58      - name: Log in to Docker Hub59        uses: docker/login-action@v260        with:61          registry: ghcr.io62          username: ${{ github.repository_owner }}63          password: ${{ secrets.GITHUB_TOKEN }}64 65      - name: Determine tag name66        id: tag67        shell: bash68        run: |69          BUILD_NUMBER="$(git rev-list --count HEAD)"70          SHORT_HASH="$(git rev-parse --short=7 HEAD)"71          REPO_OWNER="${GITHUB_REPOSITORY_OWNER@L}"  # to lower case72          REPO_NAME="${{ github.event.repository.name }}"73 74          # determine tag name postfix (build number, commit hash)75          if [[ "${{ env.GITHUB_BRANCH_NAME }}" == "master" ]]; then76            TAG_POSTFIX="-b${BUILD_NUMBER}"77          else78            SAFE_NAME=$(echo "${{ env.GITHUB_BRANCH_NAME }}" | tr '/' '-')79            TAG_POSTFIX="-${SAFE_NAME}-${SHORT_HASH}"80          fi81          # list all tags possible82          if [[ "${{ matrix.config.tag }}" == "cpu" ]]; then83              TYPE=""84          else85              TYPE="-${{ matrix.config.tag }}"86          fi87          PREFIX="ghcr.io/${REPO_OWNER}/${REPO_NAME}:"88          FULLTAGS="${PREFIX}full${TYPE},${PREFIX}full${TYPE}${TAG_POSTFIX}"89          LIGHTTAGS="${PREFIX}light${TYPE},${PREFIX}light${TYPE}${TAG_POSTFIX}"90          SERVERTAGS="${PREFIX}server${TYPE},${PREFIX}server${TYPE}${TAG_POSTFIX}"91          echo "full_output_tags=$FULLTAGS" >> $GITHUB_OUTPUT92          echo "light_output_tags=$LIGHTTAGS" >> $GITHUB_OUTPUT93          echo "server_output_tags=$SERVERTAGS" >> $GITHUB_OUTPUT94          echo "full_output_tags=$FULLTAGS"  # print out for debugging95          echo "light_output_tags=$LIGHTTAGS"  # print out for debugging96          echo "server_output_tags=$SERVERTAGS"  # print out for debugging97        env:98          GITHUB_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}99          GITHUB_REPOSITORY_OWNER: '${{ github.repository_owner }}'100 101      - name: Free Disk Space (Ubuntu)102        if: ${{ matrix.config.free_disk_space == true }}103        uses: ggml-org/free-disk-space@v1.3.1104        with:105          # this might remove tools that are actually needed,106          # if set to "true" but frees about 6 GB107          tool-cache: false108 109          # all of these default to true, but feel free to set to110          # "false" if necessary for your workflow111          android: true112          dotnet: true113          haskell: true114          large-packages: true115          docker-images: true116          swap-storage: true117 118      - name: Build and push Full Docker image (tagged + versioned)119        if: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.config.full == true }}120        uses: docker/build-push-action@v6121        with:122          context: .123          push: true124          platforms: ${{ matrix.config.platforms }}125          # tag list is generated from step above126          tags: ${{ steps.tag.outputs.full_output_tags }}127          file: ${{ matrix.config.dockerfile }}128          target: full129          provenance: false130          # using github experimental cache131          cache-from: type=gha132          cache-to: type=gha,mode=max133          # return to this if the experimental github cache is having issues134          #cache-to: type=local,dest=/tmp/.buildx-cache135          #cache-from: type=local,src=/tmp/.buildx-cache136 137      - name: Build and push Light Docker image (tagged + versioned)138        if: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.config.light == true }}139        uses: docker/build-push-action@v6140        with:141          context: .142          push: true143          platforms: ${{ matrix.config.platforms }}144          # tag list is generated from step above145          tags: ${{ steps.tag.outputs.light_output_tags }}146          file: ${{ matrix.config.dockerfile }}147          target: light148          provenance: false149          # using github experimental cache150          cache-from: type=gha151          cache-to: type=gha,mode=max152          # return to this if the experimental github cache is having issues153          #cache-to: type=local,dest=/tmp/.buildx-cache154          #cache-from: type=local,src=/tmp/.buildx-cache155 156      - name: Build and push Server Docker image (tagged + versioned)157        if: ${{ (github.event_name == 'push' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && matrix.config.server == true }}158        uses: docker/build-push-action@v6159        with:160          context: .161          push: true162          platforms: ${{ matrix.config.platforms }}163          # tag list is generated from step above164          tags: ${{ steps.tag.outputs.server_output_tags }}165          file: ${{ matrix.config.dockerfile }}166          target: server167          provenance: false168          # using github experimental cache169          cache-from: type=gha170          cache-to: type=gha,mode=max171          # return to this if the experimental github cache is having issues172          #cache-to: type=local,dest=/tmp/.buildx-cache173          #cache-from: type=local,src=/tmp/.buildx-cache174