docker.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # This workflow uses actions that are not certified by GitHub.
  2. # They are provided by a third-party and are governed by
  3. # separate terms of service, privacy policy, and support
  4. # documentation.
  5. # GitHub recommends pinning actions to a commit SHA.
  6. # To get a newer version, you will need to update the SHA.
  7. # You can also reference a tag or branch, but the action may change without warning.
  8. name: Publish Docker image
  9. on:
  10. pull_request:
  11. push:
  12. branches:
  13. - master
  14. jobs:
  15. push_to_registry:
  16. name: Push Docker image to Docker Hub
  17. runs-on: ubuntu-latest
  18. env:
  19. COMMIT_SHA: ${{ github.sha }}
  20. strategy:
  21. matrix:
  22. config:
  23. - { tag: "light", dockerfile: ".devops/main.Dockerfile" }
  24. - { tag: "full", dockerfile: ".devops/full.Dockerfile" }
  25. steps:
  26. - name: Check out the repo
  27. uses: actions/checkout@v3
  28. - name: Set up QEMU
  29. uses: docker/setup-qemu-action@v2
  30. - name: Set up Docker Buildx
  31. uses: docker/setup-buildx-action@v2
  32. - name: Log in to Docker Hub
  33. uses: docker/login-action@v2
  34. with:
  35. registry: ghcr.io
  36. username: ${{ github.actor }}
  37. password: ${{ secrets.GITHUB_TOKEN }}
  38. - name: Build and push Docker image (versioned)
  39. if: github.event_name == 'push'
  40. uses: docker/build-push-action@v4
  41. with:
  42. context: .
  43. push: true
  44. tags: "ghcr.io/ggerganov/llama.cpp:${{ matrix.config.tag }}-${{ env.COMMIT_SHA }}"
  45. file: ${{ matrix.config.dockerfile }}
  46. - name: Build and push Docker image (tagged)
  47. uses: docker/build-push-action@v4
  48. with:
  49. context: .
  50. push: ${{ github.event_name == 'push' }}
  51. tags: "ghcr.io/ggerganov/llama.cpp:${{ matrix.config.tag }}"
  52. file: ${{ matrix.config.dockerfile }}