build_base_image.yaml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. - alpine
  20. golang:
  21. - 1.20.2
  22. steps:
  23. - uses: actions/checkout@v3
  24. - uses: docker/setup-buildx-action@v2
  25. - uses: docker/setup-qemu-action@v2
  26. with:
  27. image: tonistiigi/binfmt:latest
  28. platforms: all
  29. - uses: actions/cache@v3
  30. with:
  31. path: /tmp/.docker-buildx-cache
  32. key: docker-buildx-${{ matrix.golang }}-${{ matrix.os }}
  33. - name: Docker login
  34. uses: docker/login-action@v2
  35. with:
  36. registry: ghcr.io
  37. username: ${{ github.actor }}
  38. password: ${{ github.token }}
  39. - uses: docker/build-push-action@v4
  40. if: matrix.os == 'centos'
  41. with:
  42. push: true
  43. pull: true
  44. cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
  45. cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
  46. platforms: linux/amd64,linux/arm64
  47. build-args: GO_VERSION=${{ matrix.golang }}
  48. tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
  49. file: .github/dockerfile/Dockerfile.${{ matrix.os }}
  50. - uses: docker/build-push-action@v4
  51. if: matrix.os == 'debian'
  52. with:
  53. push: true
  54. pull: true
  55. cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
  56. cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
  57. platforms: linux/amd64,linux/arm64,linux/arm/v7
  58. build-args: GO_VERSION=${{ matrix.golang }}
  59. tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
  60. file: .github/dockerfile/Dockerfile.${{ matrix.os }}
  61. - uses: docker/build-push-action@v4
  62. if: matrix.os == 'alpine'
  63. with:
  64. push: true
  65. pull: true
  66. cache-from: type=local,src=/tmp/.docker-buildx-cache,mode=max
  67. cache-to: type=local,dest=/tmp/.docker-buildx-cache-new,mode=max
  68. platforms: linux/amd64,linux/arm64,linux/arm/v7
  69. build-args: GO_VERSION=${{ matrix.golang }}
  70. tags: ghcr.io/${{ github.repository }}/base:${{ matrix.golang }}-${{ matrix.os }}
  71. file: .github/dockerfile/Dockerfile.${{ matrix.os }}
  72. - name: Update cache
  73. run: |
  74. rm -rf /tmp/.docker-buildx-cache
  75. mv /tmp/.docker-buildx-cache-new /tmp/.docker-buildx-cache