func getTagFromRef(ref types.ImageReference, log log.Logger) reference.Tagged {
	tagged, isTagged := ref.DockerReference().(reference.Tagged)
	if !isTagged {
		log.Warn().Msgf("internal server error, reference %s does not have a tag, skipping", ref.DockerReference())
		return nil
	}
	return tagged
}
getTagFromRef returns a tagged reference from an image reference.
package sync
import (
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"path"
	"strings"
	"github.com/anuvu/zot/errors"
	"github.com/anuvu/zot/pkg/log"
	"github.com/containers/image/v5/docker/reference"
	"github.com/containers/image/v5/types"
)
var certsDir = fmt.Sprintf("%s/zot-certs-dir/", os.TempDir())  
func copyFile(sourceFilePath, destFilePath string) error {
	destFile, err := os.Create(destFilePath)
	if err != nil {
		return err
	}
	defer destFile.Close()
	sourceFile, _ := os.Open(sourceFilePath)
	defer sourceFile.Close()
	if _, err := io.Copy(destFile, sourceFile); err != nil {
		return err
	}
	return nil
}
func copyLocalCerts(serverCert, serverKey, caCert string, log log.Logger) (string, error) {
	log.Debug().Msgf("Creating certs directory: %s", certsDir)
	err := os.Mkdir(certsDir, 0755)
	if err != nil && !os.IsExist(err) {
		return "", err
	}
	if serverCert != "" {
		log.Debug().Msgf("Copying server cert: %s", serverCert)
		err := copyFile(serverCert, path.Join(certsDir, "server.cert"))
		if err != nil {
			return "", err
		}
	}
	if serverKey != "" {
		log.Debug().Msgf("Copying server key: %s", serverKey)
		err := copyFile(serverKey, path.Join(certsDir, "server.key"))
		if err != nil {
			return "", err
		}
	}
	if caCert != "" {
		log.Debug().Msgf("Copying CA cert: %s", caCert)
		err := copyFile(caCert, path.Join(certsDir, "ca.crt"))
		if err != nil {
			return "", err
		}
	}
	return certsDir, nil
}