mirror of
https://github.com/thegeeklab/wp-docker-buildx.git
synced 2024-11-13 22:50:41 +00:00
Remove unused docker data
This commit is contained in:
parent
f606fcf698
commit
661ee5d652
16
plugin.go
16
plugin.go
@ -63,17 +63,6 @@ type (
|
|||||||
|
|
||||||
// Exec executes the plugin step
|
// Exec executes the plugin step
|
||||||
func (p Plugin) Exec() error {
|
func (p Plugin) Exec() error {
|
||||||
|
|
||||||
// TODO execute code remove dangling images
|
|
||||||
// this is problematic because we are running docker in scratch which does
|
|
||||||
// not have bash, so we need to hack something together
|
|
||||||
// docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi
|
|
||||||
|
|
||||||
/*
|
|
||||||
cmd = exec.Command("docker", "images", "-q", "-f", "dangling=true")
|
|
||||||
cmd = exec.Command("docker", append([]string{"rmi"}, images...)...)
|
|
||||||
*/
|
|
||||||
|
|
||||||
// start the Docker daemon server
|
// start the Docker daemon server
|
||||||
if !p.Daemon.Disabled {
|
if !p.Daemon.Disabled {
|
||||||
cmd := commandDaemon(p.Daemon)
|
cmd := commandDaemon(p.Daemon)
|
||||||
@ -123,6 +112,7 @@ func (p Plugin) Exec() error {
|
|||||||
var cmds []*exec.Cmd
|
var cmds []*exec.Cmd
|
||||||
cmds = append(cmds, commandVersion()) // docker version
|
cmds = append(cmds, commandVersion()) // docker version
|
||||||
cmds = append(cmds, commandInfo()) // docker info
|
cmds = append(cmds, commandInfo()) // docker info
|
||||||
|
cmds = append(cmds, commandDockerPrune()) // cleanup docker
|
||||||
cmds = append(cmds, commandBuild(p.Build)) // docker build
|
cmds = append(cmds, commandBuild(p.Build)) // docker build
|
||||||
|
|
||||||
for _, tag := range p.Build.Tags {
|
for _, tag := range p.Build.Tags {
|
||||||
@ -301,6 +291,10 @@ func commandDaemon(daemon Daemon) *exec.Cmd {
|
|||||||
return exec.Command(dockerdExe, args...)
|
return exec.Command(dockerdExe, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func commandDockerPrune() *exec.Cmd {
|
||||||
|
return exec.Command(dockerExe, "system", "prune", "-f")
|
||||||
|
}
|
||||||
|
|
||||||
// trace writes each command to stdout with the command wrapped in an xml
|
// trace writes each command to stdout with the command wrapped in an xml
|
||||||
// tag so that it can be extracted and displayed in the logs.
|
// tag so that it can be extracted and displayed in the logs.
|
||||||
func trace(cmd *exec.Cmd) {
|
func trace(cmd *exec.Cmd) {
|
||||||
|
Loading…
Reference in New Issue
Block a user