-
Notifications
You must be signed in to change notification settings - Fork 44
88 lines (83 loc) · 2.72 KB
/
docker-ci-amd-and-arm.yml
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
81
82
83
84
85
86
87
88
name: Docker CI Multi-Platform
on:
workflow_dispatch:
push:
branches: [main]
permissions:
contents: read
jobs:
settings:
runs-on: ubuntu-latest
outputs:
version: ${{steps.env.outputs.version}}
short_sha: ${{steps.env.outputs.short_sha}}
steps:
- uses: actions/checkout@v3
- name: Setup outputs
id: env
run: |
echo "version=$(cat ./VERSION)" >> "$GITHUB_OUTPUT"
echo "short_sha=$(git rev-parse --short=7 HEAD)" >> "$GITHUB_OUTPUT"
build:
needs: settings
strategy:
matrix:
include:
- runner: [self-hosted, X64]
arch: amd64
- runner: arm-runner
arch: arm64
runs-on: ${{ matrix.runner }}
timeout-minutes: 120
steps:
# checkout git commit
- uses: actions/checkout@v3
# Setup docker
# https://github.com/supabase/postgres/blob/develop/.github/workflows/dockerhub-release.yml#LL41C11-L42C44
- run: docker context create builders
- uses: docker/setup-buildx-action@v2
with:
endpoint: builders
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Build and push
- id: build
uses: docker/build-push-action@v3
with:
push: true
tags: supabase/logflare:${{ needs.settings.outputs.version }}-${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
# caching
cache-from: type=gha
cache-to: type=gha,mode=max
merge_publish:
needs:
- settings
- build
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup tags
run: |
echo "tag_amd64=supabase/logflare:${{ needs.settings.outputs.version }}-amd64" >> "$GITHUB_ENV"
echo "tag_arm64=supabase/logflare:${{ needs.settings.outputs.version }}-arm64" >> "$GITHUB_ENV"
echo "tag_ver=supabase/logflare:${{ needs.settings.outputs.version }}" >> "$GITHUB_ENV"
echo "tag_sha=supabase/logflare:dev-${{ needs.settings.outputs.short_sha }}" >> "$GITHUB_ENV"
- name: Staging - Merge multi-arch manifests and push the dev image
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: |
docker buildx imagetools create -t ${{ env.tag_sha }} \
${{ env.tag_amd64 }} ${{ env.tag_arm64 }}
trigger_cloudbuild:
uses: ./.github/workflows/trigger-cloudbuild.yml
needs:
- settings
- build
- merge_publish
secrets: inherit