Skip to content

Commit

Permalink
add caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyanesh Mishra authored and Gyanesh Mishra committed Dec 8, 2023
1 parent b1b640b commit a104464
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions .github/workflows/build-soci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,13 @@ jobs:
soci-release: 'v0.4.0'

- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/[email protected]
with:
cleanup: false # Keep buildkit cache around
uses: docker/setup-buildx-action@v3

- name: Set up containerd for ubuntu
uses: crazy-max/[email protected]

- name: Install skopeo
run: sudo snap install skopeo --edge --devmode

- name: Docker meta
id: meta
Expand All @@ -74,33 +69,31 @@ jobs:
run: |
tag_hash=$(echo -n "$tags" | md5sum | awk '{print $1}')
echo "tag_hash=$tag_hash" >> $GITHUB_OUTPUT
echo "cache_dir=/var/lib/kubelet/images/cache" >> $GITHUB_OUTPUT
echo "image_dir=/var/lib/kubelet/images" >> $GITHUB_OUTPUT
echo "image_path=/var/lib/kubelet/images/lorax" >> $GITHUB_OUTPUT
- name: Create and update image directory
- name: Create and update image/cache directory
env:
image_dir: ${{ steps.vars.outputs.image_dir }}
cache_dir: ${{ steps.vars.outputs.cache_dir }}
run: |
sudo mkdir -p $image_dir
sudo chown ubuntu:ubuntu $image_dir
- name: Build Docker Image Cache
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile # Path to your Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
outputs: type=cacheonly
sudo mkdir -p $cache_dir
sudo chown ubuntu:ubuntu $cache_dir
- name: Export Docker image as OCI
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile # Path to your Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
outputs: type=oci,oci-mediatypes=true,dest=${{ steps.vars.outputs.image_path }}-${{ steps.vars.outputs.tag_hash }}.tar
cache-from: type=local,dest=${{ steps.vars.outputs.cache_dir }}
cache-to: type=local,mode=max,image-manifest=true,src=${{ steps.vars.outputs.cache_dir }}

- name: Import image in containerd
env:
Expand Down

0 comments on commit a104464

Please sign in to comment.