Skip to content

Commit

Permalink
feat: added docker build caching
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Jun 30, 2024
1 parent 24de776 commit 654fca4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,27 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

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

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

0 comments on commit 654fca4

Please sign in to comment.