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