Skip to content

Commit

Permalink
feat: release docker image to ghcr (#367)
Browse files Browse the repository at this point in the history
* chore: add image mirror job

* chore: mirror docker image to ghcr

Co-authored-by: Qiao Han <qiao@supabase.io>
  • Loading branch information
w3b6x9 and sweatybridge committed Dec 5, 2022
1 parent 28f6c6f commit 90a867a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/mirror.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Mirror Image

on:
workflow_dispatch:
inputs:
version:
description: "Image tag"
required: true
type: string

jobs:
mirror:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: docker/login-action@v2
with:
registry: public.ecr.aws
username: ${{ secrets.PROD_ACCESS_KEY_ID }}
password: ${{ secrets.PROD_SECRET_ACCESS_KEY }}
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: akhilerm/tag-push-action@v2.1.0
with:
src: docker.io/supabase/realtime:${{ inputs.version }}
dst: |
public.ecr.aws/supabase/realtime:${{ inputs.version }}
ghcr.io/supabase/realtime:${{ inputs.version }}
30 changes: 13 additions & 17 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
with:
images: |
supabase/realtime
public.ecr.aws/t3w2s2c9/realtime
tags: |
type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}
Expand All @@ -57,13 +56,6 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to ECR
uses: docker/login-action@v2
with:
registry: public.ecr.aws
username: ${{ secrets.PROD_ACCESS_KEY_ID }}
password: ${{ secrets.PROD_SECRET_ACCESS_KEY }}

- id: build
uses: docker/build-push-action@v3
with:
Expand All @@ -90,7 +82,6 @@ jobs:
with:
images: |
supabase/realtime
public.ecr.aws/t3w2s2c9/realtime
tags: |
type=raw,value=v${{ needs.release.outputs.version }}_${{ env.arch }}
Expand All @@ -99,13 +90,6 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to ECR
uses: docker/login-action@v2
with:
registry: public.ecr.aws
username: ${{ secrets.PROD_ACCESS_KEY_ID }}
password: ${{ secrets.PROD_SECRET_ACCESS_KEY }}

- uses: docker/setup-buildx-action@v2
with:
driver: docker
Expand All @@ -125,6 +109,9 @@ jobs:
merge_manifest:
needs: [release, docker_x86_release, docker_arm_release]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: docker/setup-buildx-action@v2

Expand All @@ -146,8 +133,17 @@ jobs:
username: ${{ secrets.PROD_ACCESS_KEY_ID }}
password: ${{ secrets.PROD_SECRET_ACCESS_KEY }}

- 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/tag-push-action@v2.0.0
with:
src: docker.io/supabase/realtime:v${{ needs.release.outputs.version }}
dst: public.ecr.aws/t3w2s2c9/realtime:v${{ needs.release.outputs.version }}
dst: |
public.ecr.aws/supabase/realtime:v${{ needs.release.outputs.version }}
ghcr.io/supabase/realtime:v${{ needs.release.outputs.version }}

0 comments on commit 90a867a

Please sign in to comment.