First cut at vagrant post-processor for docker
This commit is contained in:
parent
4b1f96b527
commit
e7fc651f60
|
@ -5,6 +5,10 @@ LINUX_BASE_BOX = "bento/ubuntu-16.04"
|
|||
FREEBSD_BASE_BOX = "jen20/FreeBSD-12.0-CURRENT"
|
||||
|
||||
Vagrant.configure(2) do |config|
|
||||
if Vagrant.has_plugin?("vagrant-cachier")
|
||||
config.cache.scope = :box
|
||||
end
|
||||
|
||||
# Compilation and development boxes
|
||||
config.vm.define "linux", autostart: true, primary: true do |vmCfg|
|
||||
vmCfg.vm.box = LINUX_BASE_BOX
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package vagrant
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/packer/packer"
|
||||
)
|
||||
|
||||
type DockerProvider struct{}
|
||||
|
||||
func (p *DockerProvider) KeepInputArtifact() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *DockerProvider) Process(ui packer.Ui, artifact packer.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) {
|
||||
// Create the metadata
|
||||
metadata = map[string]interface{}{"provider": "docker"}
|
||||
|
||||
vagrantfile = fmt.Sprintf(dockerVagrantfile)
|
||||
return
|
||||
}
|
||||
|
||||
var dockerVagrantfile = `
|
||||
Vagrant.configure("2") do |config|
|
||||
end
|
||||
`
|
|
@ -0,0 +1,9 @@
|
|||
package vagrant
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDockerProvider_impl(t *testing.T) {
|
||||
var _ Provider = new(DockerProvider)
|
||||
}
|
|
@ -31,6 +31,7 @@ var builtins = map[string]string{
|
|||
"MSOpenTech.hyperv": "hyperv",
|
||||
"transcend.qemu": "libvirt",
|
||||
"ustream.lxc": "lxc",
|
||||
"packer.post-processor.docker-import": "docker",
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
@ -241,6 +242,8 @@ func providerForName(name string) Provider {
|
|||
return new(GoogleProvider)
|
||||
case "lxc":
|
||||
return new(LXCProvider)
|
||||
case "docker":
|
||||
return new(DockerProvider)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue