-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
44 lines (37 loc) · 807 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"github.com/mheers/imagesumdb/config"
"github.com/mheers/imagesumdb/db"
"github.com/mheers/imagesumdb/image"
)
func main() {
cfg := config.Config{
RegistryRewrites: map[string]string{
"docker.io": "registry-1.docker.io",
},
EnableRewrite: true,
DBFile: "db.yaml",
ForceDigest: true,
}
dbInstance := db.NewDB(&cfg)
err := dbInstance.ReadImagePersistance()
if err != nil {
panic(err)
}
err = dbInstance.Set("test", image.NewImage(&cfg, "", "alpine", "3.11"))
if err != nil {
panic(err)
}
err = dbInstance.Set("newer", image.NewImage(&cfg, "", "alpine", "3.16"))
if err != nil {
panic(err)
}
err = dbInstance.CompareSetImagesWithPersistance()
if err != nil {
panic(err)
}
err = dbInstance.Write()
if err != nil {
panic(err)
}
}