docker.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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" }
  25. - { tag: "full", dockerfile: ".devops/full.Dockerfile" }
  26. steps:
  27. - name: Check out the repo
  28. uses: actions/checkout@v3
  29. - name: Set up QEMU
  30. uses: docker/setup-qemu-action@v2
  31. - name: Set up Docker Buildx
  32. uses: docker/setup-buildx-action@v2
  33. - name: Log in to Docker Hub
  34. uses: docker/login-action@v2
  35. with:
  36. registry: ghcr.io
  37. username: ${{ github.repository_owner }}
  38. password: ${{ secrets.GITHUB_TOKEN }}
  39. - name: Build and push Docker image (versioned)
  40. if: github.event_name == 'push'
  41. uses: docker/build-push-action@v4
  42. with:
  43. context: .
  44. push: true
  45. platforms: linux/amd64,linux/arm64
  46. tags: "ghcr.io/ggerganov/llama.cpp:${{ matrix.config.tag }}-${{ env.COMMIT_SHA }}"
  47. file: ${{ matrix.config.dockerfile }}
  48. - name: Build and push Docker image (tagged)
  49. uses: docker/build-push-action@v4
  50. with:
  51. context: .
  52. push: ${{ github.event_name == 'push' }}
  53. platforms: linux/amd64,linux/arm64
  54. tags: "ghcr.io/ggerganov/llama.cpp:${{ matrix.config.tag }}"
  55. file: ${{ matrix.config.dockerfile }}