mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-26 15:40:35 +00:00
Add support for non label-schema labels
This commit is contained in:
parent
1e396b3b9c
commit
3edd750381
@ -171,6 +171,11 @@ func main() {
|
|||||||
Usage: "docker repository",
|
Usage: "docker repository",
|
||||||
EnvVar: "PLUGIN_REPO",
|
EnvVar: "PLUGIN_REPO",
|
||||||
},
|
},
|
||||||
|
cli.StringSliceFlag{
|
||||||
|
Name: "Labels",
|
||||||
|
Usage: "labels",
|
||||||
|
EnvVar: "PLUGIN_LABELS",
|
||||||
|
},
|
||||||
cli.StringSliceFlag{
|
cli.StringSliceFlag{
|
||||||
Name: "label-schema",
|
Name: "label-schema",
|
||||||
Usage: "label-schema labels",
|
Usage: "label-schema labels",
|
||||||
@ -242,6 +247,7 @@ func run(c *cli.Context) error {
|
|||||||
Pull: c.BoolT("pull-image"),
|
Pull: c.BoolT("pull-image"),
|
||||||
Compress: c.Bool("compress"),
|
Compress: c.Bool("compress"),
|
||||||
Repo: c.String("repo"),
|
Repo: c.String("repo"),
|
||||||
|
Labels: c.StringSlice("labels"),
|
||||||
LabelSchema: c.StringSlice("label-schema"),
|
LabelSchema: c.StringSlice("label-schema"),
|
||||||
NoCache: c.Bool("no-cache"),
|
NoCache: c.Bool("no-cache"),
|
||||||
},
|
},
|
||||||
|
10
docker.go
10
docker.go
@ -49,7 +49,8 @@ type (
|
|||||||
Pull bool // Docker build pull
|
Pull bool // Docker build pull
|
||||||
Compress bool // Docker build compress
|
Compress bool // Docker build compress
|
||||||
Repo string // Docker build repository
|
Repo string // Docker build repository
|
||||||
LabelSchema []string // Label schema map
|
LabelSchema []string // label-schema Label map
|
||||||
|
Labels []string // Label map
|
||||||
NoCache bool // Docker build no-cache
|
NoCache bool // Docker build no-cache
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,6 +215,7 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
labelSchema := []string{
|
labelSchema := []string{
|
||||||
|
"version=1.0",
|
||||||
fmt.Sprintf("build-date=%s", time.Now().Format(time.RFC3339)),
|
fmt.Sprintf("build-date=%s", time.Now().Format(time.RFC3339)),
|
||||||
fmt.Sprintf("vcs-ref=%s", build.Name),
|
fmt.Sprintf("vcs-ref=%s", build.Name),
|
||||||
fmt.Sprintf("vcs-url=%s", build.Remote),
|
fmt.Sprintf("vcs-url=%s", build.Remote),
|
||||||
@ -227,6 +229,12 @@ func commandBuild(build Build) *exec.Cmd {
|
|||||||
args = append(args, "--label", fmt.Sprintf("org.label-schema.%s", label))
|
args = append(args, "--label", fmt.Sprintf("org.label-schema.%s", label))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(build.Labels) > 0 {
|
||||||
|
for _, label := range build.Labels {
|
||||||
|
args = append(args, "--label", label)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return exec.Command(dockerExe, args...)
|
return exec.Command(dockerExe, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user