build_base_image.yaml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: Update docker base image
  2. ## Update the base image every day
  3. on:
  4. workflow_dispatch:
  5. schedule:
  6. ## In UTC
  7. - cron: '0 0 * * *'
  8. ## Build base images to be used by other github workflows
  9. jobs:
  10. build:
  11. runs-on: ubuntu-latest
  12. if: github.repository == 'lf-edge/ekuiper'
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. os:
  17. - debian
  18. - centos
  19. golang:
  20. - 1.18.5
  21. steps:
  22. - uses: actions/checkout@v2
  23. - uses: docker/setup-buildx-action@v1
  24. - uses: docker/setup-qemu-action@v1
  25. with:
  26. image: tonistiigi/binfmt:latest
  27. platforms: all
  28. - uses: actions/cache@v2
  29. with:
  30. path: /tmp/.docker-buildx-cache
  31. key: docker-buildx-${{ matrix.golang }}-${{ matrix.os }}
  32. - name: Docker login
  33. uses: docker/login-action@v1
  34. with:
  35. registry: ghcr.io
  36. username: ${{ github.actor }}
  37. password: ${{ github.token }}
  38. - uses: docker/build-push-action@v2
  39. if: matrix.os == 'centos'
  40. with:
  41. push: true
  42. pull: true
  43. cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
  44. cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
  45. platforms: linux/amd64,linux/arm64
  46. build-args: GO_VERSION=${{ matrix.golang }}
  47. tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
  48. file: .github/dockerfile/Dockerfile.${{ matrix.os }}
  49. - uses: docker/build-push-action@v2
  50. if: matrix.os == 'debian'
  51. with:
  52. push: true
  53. pull: true
  54. cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
  55. cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
  56. platforms: linux/amd64,linux/arm64,linux/arm/v7
  57. build-args: GO_VERSION=${{ matrix.golang }}
  58. tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
  59. file: .github/dockerfile/Dockerfile.${{ matrix.os }}
  60. - name: Update cache
  61. run: |
  62. rm -rf /tmp/.docker-buildx-cache
  63. mv /tmp/.docker-buildx-cache-new /tmp/.docker-buildx-cache