Skip to main content

Docker Layer Caching

Since WarpBuild Cache seamlessly integrates as a drop-in replacement for GitHub Actions Cache, you can easily use it for Docker Layer Caching.

Step 1: Set Up Docker Buildx Action

Ensure that the Docker Buildx Action is included in your workflow file if it isn't already. This step is essential to enable the GHA backend for Docker Layer Caching.

Note: Don't forget to include the driver-opts key as shown below.

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
network=host

Step 2: Configure Docker Build Push Action

Update the cache-from and cache-to fields by setting the url to http://127.0.0.1:49160/, as shown below. Ensure that the type is set to gha. WarpBuild Cache will automatically proxy the storage backend for docker layer caching.

Note: It is recommended to set mode=max. This setting ensures that all layers, including intermediate steps, are cached. For more details, read about the mode here.

- name: Docker WarpCache Backend
uses: docker/build-push-action@v6
with:
context: .
push: false
tags: "alpine/warpcache:latest"
cache-from: type=gha,url=http://127.0.0.1:49160/
cache-to: type=gha,url=http://127.0.0.1:49160/,mode=max

That's all there is to it! With these adjustments, WarpBuild Cache is now set up as your Docker Layer Caching backend.