1
0

docker.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. if: github.event.pull_request.draft == false
  18. runs-on: ubuntu-latest
  19. env:
  20. COMMIT_SHA: ${{ github.sha }}
  21. strategy:
  22. matrix:
  23. config:
  24. - { tag: "light", dockerfile: ".devops/main.Dockerfile", platforms: "linux/amd64,linux/arm64" }
  25. - { tag: "full", dockerfile: ".devops/full.Dockerfile", platforms: "linux/amd64,linux/arm64" }
  26. # NOTE(canardletter): The CUDA builds on arm64 are very slow, so I
  27. # have disabled them for now until the reason why
  28. # is understood.
  29. - { tag: "light-cuda", dockerfile: ".devops/main-cuda.Dockerfile", platforms: "linux/amd64" }
  30. - { tag: "full-cuda", dockerfile: ".devops/full-cuda.Dockerfile", platforms: "linux/amd64" }
  31. - { tag: "light-rocm", dockerfile: ".devops/main-rocm.Dockerfile", platforms: "linux/amd64,linux/arm64" }
  32. - { tag: "full-rocm", dockerfile: ".devops/full-rocm.Dockerfile", platforms: "linux/amd64,linux/arm64" }
  33. steps:
  34. - name: Check out the repo
  35. uses: actions/checkout@v3
  36. - name: Set up QEMU
  37. uses: docker/setup-qemu-action@v2
  38. - name: Set up Docker Buildx
  39. uses: docker/setup-buildx-action@v2
  40. - name: Log in to Docker Hub
  41. uses: docker/login-action@v2
  42. with:
  43. registry: ghcr.io
  44. username: ${{ github.repository_owner }}
  45. password: ${{ secrets.GITHUB_TOKEN }}
  46. - name: Build and push Docker image (versioned)
  47. if: github.event_name == 'push'
  48. uses: docker/build-push-action@v4
  49. with:
  50. context: .
  51. push: true
  52. platforms: ${{ matrix.config.platforms }}
  53. tags: "ghcr.io/ggerganov/llama.cpp:${{ matrix.config.tag }}-${{ env.COMMIT_SHA }}"
  54. file: ${{ matrix.config.dockerfile }}
  55. - name: Build and push Docker image (tagged)
  56. uses: docker/build-push-action@v4
  57. with:
  58. context: .
  59. push: ${{ github.event_name == 'push' }}
  60. platforms: ${{ matrix.config.platforms }}
  61. tags: "ghcr.io/ggerganov/llama.cpp:${{ matrix.config.tag }}"
  62. file: ${{ matrix.config.dockerfile }}