-
-
Notifications
You must be signed in to change notification settings - Fork 319
128 lines (113 loc) · 3.61 KB
/
manual_prod_build.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Manual Build Production
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to run the workflow"
required: true
docker_tag:
description: "Tag to be used by the docker image on push"
required: true
jobs:
docker_x86_release:
runs-on: ubuntu-20.04
timeout-minutes: 120
env:
arch: amd64
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- id: meta
uses: docker/metadata-action@v4
with:
images: |
supabase/realtime
tags: |
type=raw,value=${{ github.event.inputs.docker_tag }}_${{ env.arch }}
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: build
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/${{ env.arch }}
cache-from: type=gha
cache-to: type=gha,mode=max
docker_arm_release:
runs-on: arm-runner
timeout-minutes: 120
env:
arch: arm64
outputs:
image_digest: ${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@v3
- id: meta
uses: docker/metadata-action@v4
with:
images: |
supabase/realtime
tags: |
type=raw,value=${{ github.event.inputs.docker_tag }}_${{ env.arch }}
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-buildx-action@v2
with:
driver: docker
driver-opts: |
image=moby/buildkit:master
network=host
- id: build
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/${{ env.arch }}
no-cache: true
merge_manifest:
needs: [docker_x86_release, docker_arm_release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Merge multi-arch manifests for custom output
run: |
docker buildx imagetools create -t supabase/realtime:${{ github.event.inputs.docker_tag }} \
supabase/realtime@${{ needs.docker_x86_release.outputs.image_digest }} \
supabase/realtime@${{ needs.docker_arm_release.outputs.image_digest }}
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.PROD_AWS_ROLE }}
aws-region: us-east-1
- name: Login to ECR
uses: docker/login-action@v2
with:
registry: public.ecr.aws
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Mirror to ECR
uses: akhilerm/[email protected]
with:
src: docker.io/supabase/realtime:v${{ github.event.inputs.docker_tag }}
dst: |
public.ecr.aws/supabase/realtime:v${{ github.event.inputs.docker_tag }}
ghcr.io/supabase/realtime:v${{ github.event.inputs.docker_tag }}