auto_build_docker_container.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: 自动构建docker镜像
  2. on:
  3. schedule:
  4. - cron: "21 19 * * 0"
  5. watch:
  6. types: started
  7. workflow_dispatch:
  8. # push:
  9. # branches: [ main ]
  10. # pull_request:
  11. # branches: [ main ]
  12. jobs:
  13. build:
  14. runs-on: ubuntu-latest
  15. steps:
  16. - name: Check Out Repo
  17. uses: actions/checkout@v3
  18. # - name: Login to GHCR
  19. # if: github.event_name != 'pull_request'
  20. # uses: docker/login-action@v2
  21. # with:
  22. # registry: ghcr.io
  23. # username: ${{ github.repository_owner }}
  24. # password: ${{ secrets.GITHUB_TOKEN }}
  25. - name: Login to Docker Hub
  26. uses: docker/login-action@v2
  27. with:
  28. username: ${{ secrets.DOCKER_USERNAME }}
  29. password: ${{ secrets.DOCKER_PASSWORD }}
  30. - name: Docker meta
  31. id: meta
  32. uses: docker/metadata-action@v4
  33. with:
  34. # list of Docker images to use as base name for tags
  35. images: |
  36. ${{ secrets.DOCKER_USERNAME }}/zerotier-aio-zh
  37. # ghcr.io/username/app
  38. # generate Docker tags based on the following events/attributes
  39. tags: |
  40. type=raw,value=latest
  41. {{date 'YYYY/MM/DD'}}
  42. # type=schedule,pattern={{date 'YYYY/MM/DD'}}
  43. # type=semver,pattern={{version}}
  44. # type=semver,pattern=$()
  45. # type=ref,event=branch
  46. # type=sha
  47. # type=ref,event=pr
  48. # type=semver,pattern={{major}}.{{minor}}
  49. # type=semver,pattern={{major}}
  50. - name: Set up QEMU
  51. uses: docker/setup-qemu-action@v2
  52. - name: Set up Docker Buildx
  53. id: buildx
  54. uses: docker/setup-buildx-action@v2
  55. - name: Build and push all
  56. id: docker_build_all
  57. uses: docker/build-push-action@v4
  58. with:
  59. context: ./dockerfile/
  60. file: ./dockerfile/Dockerfile
  61. push: true
  62. platforms: linux/amd64,linux/arm64
  63. tags: ${{ steps.meta.outputs.tags }}
  64. labels: ${{ steps.meta.outputs.labels }}
  65. - name: all Image digest
  66. run: echo ${{ steps.docker_build_all.outputs.digest }}
粤ICP备19079148号