Skip to content

Cache Benchmark

Cache Benchmark #1

name: Cache Benchmark
on:
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ghcr.io/databuddy-analytics/databuddy
jobs:
gha-cache:
name: "GHA cache (links, amd64)"
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Mount Docker build cache
uses: useblacksmith/stickydisk@41873b1513bb679f9c115504cbd13d3660432504 # v1
with:
key: ${{ github.repository }}-cache-bench-gha
path: /tmp/docker-build-cache
- name: Set up Docker Builder
uses: useblacksmith/setup-docker-builder@ac083cc84672d01c60d5e8561d0a939b697de542 # v1
- uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build with GHA cache
uses: useblacksmith/build-push-action@cbd1f60d194a98cb3be5523b15134501eaf0fbf3 # v2
with:
context: .
file: links.Dockerfile
push: false
platforms: linux/amd64
tags: bench:gha-cache
cache-from: type=gha,scope=bench-gha
cache-to: type=gha,mode=max,scope=bench-gha
registry-cache:
name: "Registry cache (links, amd64)"
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 15
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Mount Docker build cache
uses: useblacksmith/stickydisk@41873b1513bb679f9c115504cbd13d3660432504 # v1
with:
key: ${{ github.repository }}-cache-bench-registry
path: /tmp/docker-build-cache
- name: Set up Docker Builder
uses: useblacksmith/setup-docker-builder@ac083cc84672d01c60d5e8561d0a939b697de542 # v1
- uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build with registry cache
uses: useblacksmith/build-push-action@cbd1f60d194a98cb3be5523b15134501eaf0fbf3 # v2
with:
context: .
file: links.Dockerfile
push: false
platforms: linux/amd64
tags: bench:registry-cache
cache-from: type=registry,ref=${{ env.IMAGE_PREFIX }}-links:cache-bench
cache-to: type=registry,ref=${{ env.IMAGE_PREFIX }}-links:cache-bench,mode=max