Can define volumes to collect artifacts
This commit is contained in:
parent
d2a49e5740
commit
e3a911cd05
6 changed files with 149 additions and 10 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/api/types/mount"
|
||||
"github.com/docker/docker/api/types/network"
|
||||
"github.com/docker/docker/client"
|
||||
oci "github.com/opencontainers/image-spec/specs-go/v1"
|
||||
|
|
@ -29,7 +30,7 @@ func Ps() ([]types.Container, error) {
|
|||
return containers, nil
|
||||
}
|
||||
|
||||
func Run(image string, cmd []string) (string, error) {
|
||||
func Run(image string, cmd []string, mounts []mount.Mount) (string, error) {
|
||||
cli, err := newCli()
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
@ -42,8 +43,13 @@ func Run(image string, cmd []string) (string, error) {
|
|||
AttachStderr: true,
|
||||
Image: image,
|
||||
Cmd: cmd,
|
||||
Volumes: map[string]struct{}{
|
||||
"/data": {},
|
||||
},
|
||||
},
|
||||
&container.HostConfig{
|
||||
Mounts: mounts,
|
||||
},
|
||||
&container.HostConfig{},
|
||||
&network.NetworkingConfig{},
|
||||
&oci.Platform{
|
||||
Architecture: "amd64",
|
||||
|
|
|
|||
Reference in a new issue