docker.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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=auto
  21. tags: |
  22. type=sha
  23. type=ref,event=branch
  24. type=ref,event=pr
  25. type=semver,pattern={{version}}
  26. - name: Docker metadata Loyalsoldier flavor
  27. id: loyalsoldier
  28. uses: docker/metadata-action@v5
  29. with:
  30. images: ghcr.io/${{ github.repository_owner }}/xray-core
  31. flavor: |
  32. latest=auto
  33. suffix=-ls,onlatest=true
  34. tags: |
  35. type=sha
  36. type=ref,event=branch
  37. type=ref,event=pr
  38. type=semver,pattern={{version}}
  39. - name: Login to GitHub Container Registry
  40. uses: docker/login-action@v3
  41. with:
  42. registry: ghcr.io
  43. username: ${{ github.repository_owner }}
  44. password: ${{ secrets.GITHUB_TOKEN }}
  45. - name: Set up Docker Buildx
  46. uses: docker/setup-buildx-action@v3
  47. - name: Build and push
  48. uses: docker/build-push-action@v6
  49. with:
  50. context: .
  51. platforms: |
  52. linux/amd64
  53. linux/arm64
  54. linux/loong64
  55. linux/riscv64
  56. provenance: false
  57. file: .github/docker/Dockerfile
  58. push: true
  59. tags: ${{ steps.meta.outputs.tags }}
  60. - name: Build and push Loyalsoldier flavor
  61. uses: docker/build-push-action@v6
  62. with:
  63. context: .
  64. platforms: |
  65. linux/amd64
  66. linux/arm64
  67. linux/loong64
  68. linux/riscv64
  69. provenance: false
  70. file: .github/docker/Dockerfile
  71. build-args: flavor=loyalsoldier
  72. push: true
  73. tags: |
  74. ${{ steps.loyalsoldier.outputs.tags }}