1
0

docker-publish.yml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. name: Docker
  2. on:
  3. push:
  4. branches: [ "main" ]
  5. paths:
  6. - 'Dockerfile'
  7. - 'requirements.txt'
  8. - 'VERSION'
  9. # Allow manual trigger for when you need to rebuild anyway
  10. workflow_dispatch:
  11. env:
  12. REGISTRY: ghcr.io
  13. IMAGE_NAME: ${{ github.repository }}
  14. jobs:
  15. build:
  16. runs-on: ubuntu-latest
  17. permissions:
  18. contents: read
  19. packages: write
  20. id-token: write
  21. steps:
  22. - name: Checkout repository
  23. uses: actions/checkout@v4
  24. - name: Set up Docker Buildx
  25. uses: docker/setup-buildx-action@v3
  26. - name: Log into registry ${{ env.REGISTRY }}
  27. if: github.event_name != 'pull_request'
  28. uses: docker/login-action@v3
  29. with:
  30. registry: ${{ env.REGISTRY }}
  31. username: ${{ github.actor }}
  32. password: ${{ secrets.GITHUB_TOKEN }}
  33. - name: Extract Docker metadata
  34. id: meta
  35. uses: docker/metadata-action@v5
  36. with:
  37. images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
  38. - name: Build and push Docker image for Raspberry Pi
  39. id: build-and-push
  40. uses: docker/build-push-action@v5
  41. with:
  42. context: .
  43. push: ${{ github.event_name != 'pull_request' }}
  44. tags: ${{ steps.meta.outputs.tags }}
  45. labels: ${{ steps.meta.outputs.labels }}
  46. platforms: linux/amd64,linux/arm64
  47. cache-from: type=gha
  48. cache-to: type=gha,mode=max