private RegistryAuthSupplier googleContainerRegistryAuthSupplier() throws MojoExecutionException {
    GoogleCredentials credentials = null;

    final String googleCredentialsPath = System.getenv("DOCKER_GOOGLE_CREDENTIALS");
    if (googleCredentialsPath != null) {
      final File file = new File(googleCredentialsPath);
      if (file.exists()) {
        try {
          try (FileInputStream inputStream = new FileInputStream(file)) {
            credentials = GoogleCredentials.fromStream(inputStream);
            getLog().info("Using Google credentials from file: " + file.getAbsolutePath());
          }
        } catch (IOException ex) {
          throw new MojoExecutionException("Cannot load credentials referenced by "
                                           + "DOCKER_GOOGLE_CREDENTIALS environment variable", ex);
        }
      }
    }

    // use the ADC last
    if (credentials == null) {
      try {
        credentials = GoogleCredentials.getApplicationDefault();
        getLog().info("Using Google application default credentials");
      } catch (IOException ex) {
        // No GCP default credentials available
        getLog().debug("Failed to load Google application default credentials", ex);
      }
    }

    if (credentials == null) {
      return null;
    }

    return ContainerRegistryAuthSupplier.forCredentials(credentials).build();
  }
Attempt to load a GCR compatible RegistryAuthSupplier based on a few conditions:
<ol>
<li>First check to see if the environemnt variable DOCKER_GOOGLE_CREDENTIALS is set and points
to a readable file</li>
<li>Otherwise check if the Google Application Default Credentials can be loaded</li>
</ol>
Note that we use a special environment variable of our own in addition to any environment
variable that the ADC loading uses (GOOGLE_APPLICATION_CREDENTIALS) in case there is a need for
the user to use the latter env var for some other purpose in their build.

@return a GCR RegistryAuthSupplier, or null
@throws MojoExecutionException if an IOException occurs while loading the explicitly-requested
                               credentials
src/main/java/com/spotify/docker/AbstractDockerMojo.java