Skip to content

Caching

RunsOn automatically sets up a dedicated S3 bucket to act as a cache backend for your GitHub Actions. This bucket has the following properties:

  • it is local to your RunsOn stack, in the same region, and all the traffic stays within the VPC, via the use of a free S3 gateway VPC endpoint.
  • can be accessed without any credential setup from your runners, using the ${{ env.RUNS_ON_S3_BUCKET_CACHE }} environment variable.
  • has unlimited size, instead of the default 10GB available on GitHub (items older than 10 days are automatically evicted).
  • has insane network throughput, at least 3x what you will find on GitHub (100MB/s for default GitHub cache backend vs 300-400MB/s for RunsOn s3 backend).
  • can be used as a drop-in replacement for the official actions/cache@v4 action. If the workflow is run outside RunsOn, it will transparently fallback to the default GitHub caching backend.
  • can be used to cache docker layers.

Using the S3 cache for dependency caching

- uses: actions/cache@v4
- uses: runs-on/cache@v4
with:
...

That’s it. All the other options from the official action are available.

See the difference for yourself:

Cache benchmark between RunsOn and GitHub

Using the S3 cache for docker layer caching

This S3 backend can also be used to cache docker layers, to greatly speedup your future docker builds. Simply use the S3 buildx cache backend and you’re good to go:

- name: "Build and push image"
uses: docker/build-push-action@v4
with:
context: "."
push: true
tags: <your-tag>
cache-from: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }}
cache-to: type=s3,blobs_prefix=cache/${{ github.repository }}/,manifests_prefix=cache/${{ github.repository }}/,region=${{ env.RUNS_ON_AWS_REGION }},bucket=${{ env.RUNS_ON_S3_BUCKET_CACHE }},mode=max