mirror of
https://github.com/thegeeklab/drone-docker-buildx.git
synced 2024-11-04 20:10: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
|
||||
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
|
||||
if !p.Daemon.Disabled {
|
||||
cmd := commandDaemon(p.Daemon)
|
||||
@ -123,6 +112,7 @@ func (p Plugin) Exec() error {
|
||||
var cmds []*exec.Cmd
|
||||
cmds = append(cmds, commandVersion()) // docker version
|
||||
cmds = append(cmds, commandInfo()) // docker info
|
||||
cmds = append(cmds, commandDockerPrune()) // cleanup docker
|
||||
cmds = append(cmds, commandBuild(p.Build)) // docker build
|
||||
|
||||
for _, tag := range p.Build.Tags {
|
||||
@ -301,6 +291,10 @@ func commandDaemon(daemon Daemon) *exec.Cmd {
|
||||
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
|
||||
// tag so that it can be extracted and displayed in the logs.
|
||||
func trace(cmd *exec.Cmd) {
|
||||
|
Loading…
Reference in New Issue
Block a user