lhico / docker4roms

Repository to store files related to docker and docker-compose, in order to run the Regional Ocean Model System.
7 stars 2 forks source link

Optimize github action workflow by using dockerhub cache #3

Open nilodna opened 2 years ago

nilodna commented 2 years ago

Implement the cache method through the docker hub registry in the github action workflows. This reduces the build time as it will not have to run instructions that have not been impacted by changes in the Dockerfiles and also reduces the number of pulls we complete against Docker Hub.

This should work only by adding the following code at the end of the yaml file:

          builder: ${{ steps.buildx.outputs.name }}
          push: true
          tags: ${{ secrets.DOCKER_USER }}/docker4roms:latest
          cache-from: type=registry,ref=${{ secrets.DOCKER_USER }}/docker4roms:buildcache
          cache-to: type=registry,ref=${{ secrets.DOCKER_USER }}/docker4roms:buildcache,mode=max