Skip to content

Commit

Permalink
feat: add docker build caching
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Jun 30, 2024
1 parent 8ebf716 commit bdc1942
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy-ntfy-do.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,49 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Cache Docker layers for Naarad
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-naarad
key: ${{ runner.os }}-buildx-naarad-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-naarad-
- name: Build & Push Naarad
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/naarad:latest
cache-from: type=local,src=/tmp/.buildx-cache-naarad
cache-to: type=local,dest=/tmp/.buildx-cache-naarad-new,mode=max

- name: Move Naarad cache
run: |
rm -rf /tmp/.buildx-cache-naarad
mv /tmp/.buildx-cache-naarad-new /tmp/.buildx-cache-naarad
- name: Cache Docker layers for Naarad API
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache-naarad-api
key: ${{ runner.os }}-buildx-naarad-api-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-naarad-api-
- name: Build & Push Naarad API
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/naarad-api:latest
cache-from: type=local,src=/tmp/.buildx-cache-naarad-api
cache-to: type=local,dest=/tmp/.buildx-cache-naarad-api-new,mode=max

- name: Move Naarad API cache
run: |
rm -rf /tmp/.buildx-cache-naarad-api
mv /tmp/.buildx-cache-naarad-api-new /tmp/.buildx-cache-naarad-api
push:
name: Push Code Stage
Expand Down

0 comments on commit bdc1942

Please sign in to comment.