build-infra-dockers.yaml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. name: Build Infrastructure Images
  2. on:
  3. push:
  4. branches:
  5. - infrastructure
  6. - infra-*
  7. env:
  8. GO_VERSION: "~1.22.3"
  9. CGO_ENABLED: "0"
  10. BUILD_USER: docker
  11. BUILD_HOST: github.syncthing.net
  12. jobs:
  13. docker-syncthing:
  14. name: Build and push Docker images
  15. if: github.repository == 'syncthing/syncthing'
  16. runs-on: ubuntu-latest
  17. environment: docker
  18. strategy:
  19. matrix:
  20. pkg:
  21. - stcrashreceiver
  22. - strelaypoolsrv
  23. - stupgrades
  24. - ursrv
  25. steps:
  26. - uses: actions/checkout@v4
  27. with:
  28. fetch-depth: 0
  29. - uses: actions/setup-go@v5
  30. with:
  31. go-version: ${{ env.GO_VERSION }}
  32. check-latest: true
  33. - name: Login to Docker Hub
  34. uses: docker/login-action@v3
  35. with:
  36. username: ${{ secrets.DOCKERHUB_USERNAME }}
  37. password: ${{ secrets.DOCKERHUB_TOKEN }}
  38. - name: Build binaries
  39. run: |
  40. for arch in arm64 amd64; do
  41. go run build.go -goos linux -goarch "$arch" build ${{ matrix.pkg }}
  42. mv ${{ matrix.pkg }} ${{ matrix.pkg }}-linux-"$arch"
  43. done
  44. - name: Set up Docker Buildx
  45. uses: docker/setup-buildx-action@v3
  46. - name: Set Docker tags (all branches)
  47. run: |
  48. tags=syncthing/${{ matrix.pkg }}:${{ github.sha }}
  49. echo "TAGS=$tags" >> $GITHUB_ENV
  50. - name: Set Docker tags (latest)
  51. if: github.ref == 'refs/heads/infrastructure'
  52. run: |
  53. tags=syncthing/${{ matrix.pkg }}:latest,${{ env.TAGS }}
  54. echo "TAGS=$tags" >> $GITHUB_ENV
  55. - name: Build and push
  56. uses: docker/build-push-action@v5
  57. with:
  58. context: .
  59. file: ./Dockerfile.${{ matrix.pkg }}
  60. platforms: linux/amd64,linux/arm64
  61. push: true
  62. tags: ${{ env.TAGS }}
  63. labels: |
  64. org.opencontainers.image.revision=${{ github.sha }}