Skip to content

Commit

Permalink
feat: properly cache
Browse files Browse the repository at this point in the history
  • Loading branch information
johnson2427 committed Aug 15, 2024
1 parent 69e7270 commit 65a9de8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Cache Docker Layers
uses: actions/cache@v4
with:
path: /tmp/docker-cache
key: ${{ runner.os }}-docker-${{ github.sha }}
restore-keys: |
${{ runner.os }}-docker-
- name: Log into GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
Expand All @@ -53,8 +61,8 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}-slim
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
cache-from: type=local,src=/tmp/docker-cache
cache-to: type=local,dest=/tmp/docker-cache

- name: Build and push
uses: docker/build-push-action@v4
Expand All @@ -64,7 +72,7 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
cache-from: type=local,src=/tmp/docker-cache
cache-to: type=local,dest=/tmp/docker-cache
build-args: |
SLIM_IMAGE=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.tags }}-slim
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPY ./recommended-plugins.txt ./recommended-plugins.txt

RUN pip wheel .[recommended-plugins] --wheel-dir=/wheels

FROM ${SLIM_IMAGE}
FROM ${SLIM_IMAGE} AS ape_slim

USER root

Expand Down

0 comments on commit 65a9de8

Please sign in to comment.