docker.yml 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: Build docker image
  2. on:
  3. release:
  4. types: [published]
  5. push:
  6. branches:
  7. - main
  8. jobs:
  9. build-image:
  10. runs-on: ubuntu-latest
  11. permissions:
  12. packages: write
  13. steps:
  14. - uses: actions/checkout@v4
  15. - name: Docker metadata
  16. id: meta
  17. uses: docker/metadata-action@v5
  18. with:
  19. images: ghcr.io/${{ github.repository_owner }}/xray-core
  20. flavor: latest=true
  21. tags: |
  22. type=sha
  23. type=ref,event=branch
  24. type=ref,event=pr
  25. type=semver,pattern={{version}}
  26. - name: Login to GitHub Container Registry
  27. uses: docker/login-action@v3
  28. with:
  29. registry: ghcr.io
  30. username: ${{ github.repository_owner }}
  31. password: ${{ secrets.GITHUB_TOKEN }}
  32. - # Add support for more platforms with QEMU (optional)
  33. # https://github.com/docker/setup-qemu-action
  34. name: Set up QEMU
  35. uses: docker/setup-qemu-action@v3
  36. - name: Set up Docker Buildx
  37. uses: docker/setup-buildx-action@v3
  38. - name: Build and push
  39. uses: docker/build-push-action@v6
  40. with:
  41. context: .
  42. platforms: linux/amd64,linux/arm64
  43. file: .github/docker/Dockerfile
  44. push: true
  45. tags: ${{ steps.meta.outputs.tags }}
  46. labels: ${{ steps.meta.outputs.labels }}