build-image.yml 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: Build container image
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - "main"
  7. tags:
  8. - "*"
  9. pull_request:
  10. paths:
  11. - .github/workflows/build-image.yml
  12. - Dockerfile
  13. jobs:
  14. build-image:
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v2
  18. - uses: docker/setup-qemu-action@v1
  19. - uses: docker/setup-buildx-action@v1
  20. - uses: docker/login-action@v1
  21. with:
  22. username: ${{ secrets.DOCKERHUB_USERNAME }}
  23. password: ${{ secrets.DOCKERHUB_TOKEN }}
  24. - uses: docker/metadata-action@v3
  25. id: meta
  26. with:
  27. images: tootsuite/mastodon
  28. flavor: |
  29. latest=auto
  30. tags: |
  31. type=edge,branch=main
  32. type=semver,pattern={{ raw }}
  33. - uses: docker/build-push-action@v2
  34. with:
  35. context: .
  36. platforms: linux/amd64,linux/arm64
  37. push: ${{ github.event_name != 'pull_request' }}
  38. tags: ${{ steps.meta.outputs.tags }}
  39. cache-from: type=registry,ref=tootsuite/mastodon:latest
  40. cache-to: type=inline