@@ -2,6 +2,10 @@ name: Push
22
33on : [push, workflow_dispatch]
44
5+ env :
6+ BUILDX_CACHE : /tmp/.buildx-cache
7+ CACHE_KEY : docker-erddap-buildx-
8+
59jobs :
610 build :
711 name : Build and test Docker Image
@@ -12,19 +16,31 @@ jobs:
1216 - name : Checkout
1317 uses : actions/checkout@v1
1418
15- - name : Cache Docker Layers
16- uses : satackey/action-docker-layer-caching@v0.0.11
17- continue-on-error : true
19+ - name : Set up Docker Buildx
20+ uses : docker/setup-buildx-action@v1
21+
22+ - name : Cache Docker layers
23+ uses : actions/cache@v2
24+ with :
25+ path : ${{ BUILDX_CACHE }}
26+ key : ${{ CACHE_KEY }}${{ github.sha }}
27+ restore-keys : |
28+ ${{ CACHE_KEY }}
1829
1930 - name : Login to Docker Hub
20- uses : azure/ docker- login@v1
31+ uses : docker/ login-action @v1
2132 continue-on-error : true
2233 with :
2334 username : ${{ secrets.DOCKER_USERNAME }}
2435 password : ${{ secrets.DOCKER_PASSWORD }}
25-
26- - name : Build Docker Image
27- run : docker build --tag axiom/docker-erddap:latest .
36+
37+ - name : Build and push
38+ uses : docker/build-push-action@v2
39+ with :
40+ push : false
41+ tags : axiom/docker-erddap:latest
42+ cache-from : type=local,src=${{ BUILDX_CACHE }}
43+ cache-to : type=local,dest=${{ BUILDX_CACHE }}
2844
2945 - name : Run Docker Image in Background
3046 run : docker run -d -p 8080:8080 axiom/docker-erddap:latest
@@ -46,14 +62,27 @@ jobs:
4662 - name : Checkout
4763 uses : actions/checkout@v1
4864
49- - name : Cache Docker Layers
50- uses : satackey/action-docker-layer-caching@v0.0.11
65+ - name : Set up Docker Buildx
66+ uses : docker/setup-buildx-action@v1
67+
68+ - name : Cache Docker layers
69+ uses : actions/cache@v2
70+ with :
71+ path : ${{ BUILDX_CACHE }}
72+ key : ${{ CACHE_KEY }}${{ github.sha }}
73+ restore-keys : |
74+ ${{ CACHE_KEY }}
5175
5276 - name : Login to Docker Hub
53- uses : azure/ docker- login@v1
77+ uses : docker/ login-action @v1
5478 with :
5579 username : ${{ secrets.DOCKER_USERNAME }}
5680 password : ${{ secrets.DOCKER_PASSWORD }}
5781
5882 - name : Push latest image to Docker Hub if on master or main branch of Axiom's repo
59- run : docker push axiom/docker-erddap:latest
83+ uses : docker/build-push-action@v2
84+ with :
85+ push : true
86+ tags : axiom/docker-erddap:latest
87+ cache-from : type=local,src=${{ BUILDX_CACHE }}
88+ cache-to : type=local,dest=${{ BUILDX_CACHE }}
0 commit comments