diff --git a/builder/docker/artifact_export.go b/builder/docker/artifact_export.go new file mode 100644 index 000000000..29cbefb48 --- /dev/null +++ b/builder/docker/artifact_export.go @@ -0,0 +1,32 @@ +package docker + +import ( + "fmt" + "os" +) + +// ExportArtifact is an Artifact implementation for when a container is +// exported from docker into a single flat file. +type ExportArtifact struct { + path string +} + +func (*ExportArtifact) BuilderId() string { + return BuilderId +} + +func (a *ExportArtifact) Files() []string { + return []string{a.path} +} + +func (*ExportArtifact) Id() string { + return "Container" +} + +func (a *ExportArtifact) String() string { + return fmt.Sprintf("Exported Docker file: %s", a.path) +} + +func (a *ExportArtifact) Destroy() error { + return os.Remove(a.path) +} diff --git a/builder/docker/artifact_export_test.go b/builder/docker/artifact_export_test.go new file mode 100644 index 000000000..be7ce2444 --- /dev/null +++ b/builder/docker/artifact_export_test.go @@ -0,0 +1,10 @@ +package docker + +import ( + "github.com/mitchellh/packer/packer" + "testing" +) + +func TestExportArtifact_impl(t *testing.T) { + var _ packer.Artifact = new(ExportArtifact) +} diff --git a/builder/docker/builder.go b/builder/docker/builder.go index 4c52827ed..f42e4b30d 100644 --- a/builder/docker/builder.go +++ b/builder/docker/builder.go @@ -78,7 +78,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe return nil, rawErr.(error) } - return nil, nil + // No errors, must've worked + artifact := &ExportArtifact{path: b.config.ExportPath} + return artifact, nil } func (b *Builder) Cancel() {