docker.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # GitHub actions workflow which builds and publishes the docker images.
  2. name: Build docker images
  3. on:
  4. push:
  5. tags: ["v*"]
  6. branches: [ master, main, develop ]
  7. workflow_dispatch:
  8. permissions:
  9. contents: read
  10. jobs:
  11. build:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Set up QEMU
  15. id: qemu
  16. uses: docker/setup-qemu-action@v1
  17. with:
  18. platforms: arm64
  19. - name: Set up Docker Buildx
  20. id: buildx
  21. uses: docker/setup-buildx-action@v1
  22. - name: Inspect builder
  23. run: docker buildx inspect
  24. - name: Log in to DockerHub
  25. uses: docker/login-action@v1
  26. with:
  27. username: ${{ secrets.DOCKERHUB_USERNAME }}
  28. password: ${{ secrets.DOCKERHUB_TOKEN }}
  29. - name: Calculate docker image tag
  30. id: set-tag
  31. uses: docker/metadata-action@master
  32. with:
  33. images: matrixdotorg/synapse
  34. flavor: |
  35. latest=false
  36. tags: |
  37. type=raw,value=develop,enable=${{ github.ref == 'refs/heads/develop' }}
  38. type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
  39. type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
  40. type=pep440,pattern={{raw}}
  41. - name: Build and push all platforms
  42. uses: docker/build-push-action@v2
  43. with:
  44. push: true
  45. labels: "gitsha1=${{ github.sha }}"
  46. tags: "${{ steps.set-tag.outputs.tags }}"
  47. file: "docker/Dockerfile"
  48. platforms: linux/amd64,linux/arm64