@@ -11,12 +11,40 @@ jobs:
1111      - name : Checkout code 
12121313
14+       - name : Set up JDK 21 
15+ 16+         with :
17+           distribution : ' temurin' 
18+           java-version : ' 21' 
19+           cache : gradle 
20+ 
21+       - name : Cache Gradle packages 
22+         uses : actions/cache@v3 
23+         with :
24+           path : | 
25+             ~/.gradle/caches 
26+             ~/.gradle/wrapper 
27+            key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} 
28+           restore-keys : | 
29+             ${{ runner.os }}-gradle- 
30+ 
31+        - name : Set up Docker Buildx 
32+         uses : docker/setup-buildx-action@v3 
33+ 
1434      - name : Log in to Docker Hub 
15351636        with :
1737          username : ${{ secrets.DOCKER_USERNAME }} 
1838          password : ${{ secrets.DOCKER_PASSWORD }} 
1939
40+       - name : Cache Docker layers 
41+         uses : actions/cache@v3 
42+         with :
43+           path : /tmp/.buildx-cache 
44+           key : ${{ runner.os }}-buildx-${{ github.sha }} 
45+           restore-keys : | 
46+             ${{ runner.os }}-buildx- 
47+ 
2048       - name : Build and Push Docker image 
2149        if : github.ref == 'refs/heads/main' 
2250@@ -26,11 +54,17 @@ jobs:
2654          push : true 
2755          tags : ${{ secrets.DOCKER_USERNAME }}/${{ secrets.PROD_IMAGE_NAME }}:latest 
2856          platforms : linux/amd64 
57+           cache-from : type=local,src=/tmp/.buildx-cache 
58+           cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max 
59+ 
60+       - name : Move cache 
61+         run : | 
62+           rm -rf /tmp/.buildx-cache 
63+           mv /tmp/.buildx-cache-new /tmp/.buildx-cache 
2964
3065   deploy :
3166    runs-on : ubuntu-latest 
3267    needs : build 
33- 
3468    steps :
3569      - name : SSH to Server and Deploy 
3670        if : github.ref == 'refs/heads/main' 
0 commit comments