Skip to content

Commit 7ecffd9

Browse files
gautamg795Convex, Inc.
authored and
Convex, Inc.
committed
add S3 caching for OSS docker builds (#34064)
Use S3 to cache docker layers instead of GHA, which keeps emptying the cache too often GitOrigin-RevId: 3ac4cdd1bbbcd216e95151c3256a9898b10a610b
1 parent c1b682e commit 7ecffd9

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/workflows/release_local_backend.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag_latest:
7-
description: 'Tag image as latest'
7+
description: "Tag image as latest"
88
type: boolean
99
default: false
1010
required: true
@@ -48,8 +48,12 @@ jobs:
4848
file: self-hosted/Dockerfile.backend
4949
tags: |
5050
ghcr.io/get-convex/self-hosted-backend
51-
cache-from: type=gha,mode=max
52-
cache-to: type=gha,mode=max
51+
cache-from: |
52+
type=s3,name=self-hosted-backend-${{ matrix.arch }}-${{ github.sha }},prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
53+
type=s3,name=self-hosted-backend-${{ matrix.arch }}-${{ github.ref_name }},prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
54+
cache-to: |
55+
type=s3,name=self-hosted-backend-${{ matrix.arch }}-${{ github.sha }},mode=max,prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
56+
type=s3,name=self-hosted-backend-${{ matrix.arch }}-${{ github.ref_name }},mode=max,prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
5357
outputs: push-by-digest=true,type=image,push=true
5458
provenance: false
5559
build-args: |
@@ -97,7 +101,7 @@ jobs:
97101
--amend ghcr.io/get-convex/self-hosted-backend@${{ fromJson(needs.read.outputs.result).digest.x64 }} \
98102
--amend ghcr.io/get-convex/self-hosted-backend@${{ fromJson(needs.read.outputs.result).digest.arm64 }}
99103
docker manifest push ghcr.io/get-convex/self-hosted-backend:${{ github.sha }}
100-
104+
101105
if [[ "${{ github.event.inputs.tag_latest }}" == "true" ]]; then
102106
docker manifest create ghcr.io/get-convex/self-hosted-backend:latest \
103107
--amend ghcr.io/get-convex/self-hosted-backend@${{ fromJson(needs.read.outputs.result).digest.x64 }} \

.github/workflows/release_local_dashboard.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag_latest:
7-
description: 'Tag image as latest'
7+
description: "Tag image as latest"
88
type: boolean
99
default: false
1010
required: true
@@ -45,8 +45,12 @@ jobs:
4545
file: self-hosted/Dockerfile.dashboard
4646
tags: |
4747
ghcr.io/get-convex/self-hosted-dashboard
48-
cache-from: type=gha,mode=max
49-
cache-to: type=gha,mode=max
48+
cache-from: |
49+
type=s3,name=self-hosted-dashboard-${{ matrix.arch }}-${{ github.ref_name }},prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
50+
type=s3,name=self-hosted-dashboard-${{ matrix.arch }}-${{ github.sha }},prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
51+
cache-to: |
52+
type=s3,name=self-hosted-dashboard-${{ matrix.arch }}-${{ github.sha }},mode=max,prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
53+
type=s3,name=self-hosted-dashboard-${{ matrix.arch }}-${{ github.ref_name }},mode=max,prefix=buildkit,region=${{ vars.AWS_REGION }},bucket=${{ vars.RUNS_ON_S3_BUCKET_CACHE }}
5054
outputs: push-by-digest=true,type=image,push=true
5155
provenance: false
5256

@@ -91,7 +95,7 @@ jobs:
9195
--amend ghcr.io/get-convex/self-hosted-dashboard@${{ fromJson(needs.read.outputs.result).digest.x64 }} \
9296
--amend ghcr.io/get-convex/self-hosted-dashboard@${{ fromJson(needs.read.outputs.result).digest.arm64 }}
9397
docker manifest push ghcr.io/get-convex/self-hosted-dashboard:${{ github.sha }}
94-
98+
9599
if [[ "${{ github.event.inputs.tag_latest }}" == "true" ]]; then
96100
docker manifest create ghcr.io/get-convex/self-hosted-dashboard:latest \
97101
--amend ghcr.io/get-convex/self-hosted-dashboard@${{ fromJson(needs.read.outputs.result).digest.x64 }} \

0 commit comments

Comments
 (0)