Adding documentation for import changes.
This commit is contained in:
parent
3cc83167c8
commit
6d10badc70
|
@ -14,22 +14,41 @@ import (
|
||||||
"github.com/hashicorp/packer/packer/plugin"
|
"github.com/hashicorp/packer/packer/plugin"
|
||||||
|
|
||||||
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
alicloudecsbuilder "github.com/hashicorp/packer/builder/alicloud/ecs"
|
||||||
|
alicloudimportpostprocessor "github.com/hashicorp/packer/post-processor/alicloud-import"
|
||||||
amazonchrootbuilder "github.com/hashicorp/packer/builder/amazon/chroot"
|
amazonchrootbuilder "github.com/hashicorp/packer/builder/amazon/chroot"
|
||||||
amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs"
|
amazonebsbuilder "github.com/hashicorp/packer/builder/amazon/ebs"
|
||||||
amazonebssurrogatebuilder "github.com/hashicorp/packer/builder/amazon/ebssurrogate"
|
amazonebssurrogatebuilder "github.com/hashicorp/packer/builder/amazon/ebssurrogate"
|
||||||
amazonebsvolumebuilder "github.com/hashicorp/packer/builder/amazon/ebsvolume"
|
amazonebsvolumebuilder "github.com/hashicorp/packer/builder/amazon/ebsvolume"
|
||||||
|
amazonimportpostprocessor "github.com/hashicorp/packer/post-processor/amazon-import"
|
||||||
amazoninstancebuilder "github.com/hashicorp/packer/builder/amazon/instance"
|
amazoninstancebuilder "github.com/hashicorp/packer/builder/amazon/instance"
|
||||||
|
ansiblelocalprovisioner "github.com/hashicorp/packer/provisioner/ansible-local"
|
||||||
|
ansibleprovisioner "github.com/hashicorp/packer/provisioner/ansible"
|
||||||
|
artificepostprocessor "github.com/hashicorp/packer/post-processor/artifice"
|
||||||
azurearmbuilder "github.com/hashicorp/packer/builder/azure/arm"
|
azurearmbuilder "github.com/hashicorp/packer/builder/azure/arm"
|
||||||
|
breakpointprovisioner "github.com/hashicorp/packer/provisioner/breakpoint"
|
||||||
|
checksumpostprocessor "github.com/hashicorp/packer/post-processor/checksum"
|
||||||
|
chefclientprovisioner "github.com/hashicorp/packer/provisioner/chef-client"
|
||||||
|
chefsoloprovisioner "github.com/hashicorp/packer/provisioner/chef-solo"
|
||||||
cloudstackbuilder "github.com/hashicorp/packer/builder/cloudstack"
|
cloudstackbuilder "github.com/hashicorp/packer/builder/cloudstack"
|
||||||
|
compresspostprocessor "github.com/hashicorp/packer/post-processor/compress"
|
||||||
|
convergeprovisioner "github.com/hashicorp/packer/provisioner/converge"
|
||||||
digitaloceanbuilder "github.com/hashicorp/packer/builder/digitalocean"
|
digitaloceanbuilder "github.com/hashicorp/packer/builder/digitalocean"
|
||||||
dockerbuilder "github.com/hashicorp/packer/builder/docker"
|
dockerbuilder "github.com/hashicorp/packer/builder/docker"
|
||||||
|
dockerimportpostprocessor "github.com/hashicorp/packer/post-processor/docker-import"
|
||||||
|
dockerpushpostprocessor "github.com/hashicorp/packer/post-processor/docker-push"
|
||||||
|
dockersavepostprocessor "github.com/hashicorp/packer/post-processor/docker-save"
|
||||||
|
dockertagpostprocessor "github.com/hashicorp/packer/post-processor/docker-tag"
|
||||||
filebuilder "github.com/hashicorp/packer/builder/file"
|
filebuilder "github.com/hashicorp/packer/builder/file"
|
||||||
|
fileprovisioner "github.com/hashicorp/packer/provisioner/file"
|
||||||
googlecomputebuilder "github.com/hashicorp/packer/builder/googlecompute"
|
googlecomputebuilder "github.com/hashicorp/packer/builder/googlecompute"
|
||||||
|
googlecomputeexportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-export"
|
||||||
|
googlecomputeimportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-import"
|
||||||
hcloudbuilder "github.com/hashicorp/packer/builder/hcloud"
|
hcloudbuilder "github.com/hashicorp/packer/builder/hcloud"
|
||||||
hypervisobuilder "github.com/hashicorp/packer/builder/hyperv/iso"
|
hypervisobuilder "github.com/hashicorp/packer/builder/hyperv/iso"
|
||||||
hypervvmcxbuilder "github.com/hashicorp/packer/builder/hyperv/vmcx"
|
hypervvmcxbuilder "github.com/hashicorp/packer/builder/hyperv/vmcx"
|
||||||
lxcbuilder "github.com/hashicorp/packer/builder/lxc"
|
lxcbuilder "github.com/hashicorp/packer/builder/lxc"
|
||||||
lxdbuilder "github.com/hashicorp/packer/builder/lxd"
|
lxdbuilder "github.com/hashicorp/packer/builder/lxd"
|
||||||
|
manifestpostprocessor "github.com/hashicorp/packer/post-processor/manifest"
|
||||||
ncloudbuilder "github.com/hashicorp/packer/builder/ncloud"
|
ncloudbuilder "github.com/hashicorp/packer/builder/ncloud"
|
||||||
nullbuilder "github.com/hashicorp/packer/builder/null"
|
nullbuilder "github.com/hashicorp/packer/builder/null"
|
||||||
oneandonebuilder "github.com/hashicorp/packer/builder/oneandone"
|
oneandonebuilder "github.com/hashicorp/packer/builder/oneandone"
|
||||||
|
@ -38,46 +57,28 @@ import (
|
||||||
oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci"
|
oracleocibuilder "github.com/hashicorp/packer/builder/oracle/oci"
|
||||||
parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso"
|
parallelsisobuilder "github.com/hashicorp/packer/builder/parallels/iso"
|
||||||
parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm"
|
parallelspvmbuilder "github.com/hashicorp/packer/builder/parallels/pvm"
|
||||||
|
powershellprovisioner "github.com/hashicorp/packer/provisioner/powershell"
|
||||||
profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks"
|
profitbricksbuilder "github.com/hashicorp/packer/builder/profitbricks"
|
||||||
|
puppetmasterlessprovisioner "github.com/hashicorp/packer/provisioner/puppet-masterless"
|
||||||
|
puppetserverprovisioner "github.com/hashicorp/packer/provisioner/puppet-server"
|
||||||
qemubuilder "github.com/hashicorp/packer/builder/qemu"
|
qemubuilder "github.com/hashicorp/packer/builder/qemu"
|
||||||
|
saltmasterlessprovisioner "github.com/hashicorp/packer/provisioner/salt-masterless"
|
||||||
scalewaybuilder "github.com/hashicorp/packer/builder/scaleway"
|
scalewaybuilder "github.com/hashicorp/packer/builder/scaleway"
|
||||||
|
shelllocalpostprocessor "github.com/hashicorp/packer/post-processor/shell-local"
|
||||||
|
shelllocalprovisioner "github.com/hashicorp/packer/provisioner/shell-local"
|
||||||
|
shellprovisioner "github.com/hashicorp/packer/provisioner/shell"
|
||||||
tritonbuilder "github.com/hashicorp/packer/builder/triton"
|
tritonbuilder "github.com/hashicorp/packer/builder/triton"
|
||||||
|
vagrantcloudpostprocessor "github.com/hashicorp/packer/post-processor/vagrant-cloud"
|
||||||
|
vagrantpostprocessor "github.com/hashicorp/packer/post-processor/vagrant"
|
||||||
virtualboxisobuilder "github.com/hashicorp/packer/builder/virtualbox/iso"
|
virtualboxisobuilder "github.com/hashicorp/packer/builder/virtualbox/iso"
|
||||||
virtualboxovfbuilder "github.com/hashicorp/packer/builder/virtualbox/ovf"
|
virtualboxovfbuilder "github.com/hashicorp/packer/builder/virtualbox/ovf"
|
||||||
vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso"
|
vmwareisobuilder "github.com/hashicorp/packer/builder/vmware/iso"
|
||||||
vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx"
|
vmwarevmxbuilder "github.com/hashicorp/packer/builder/vmware/vmx"
|
||||||
alicloudimportpostprocessor "github.com/hashicorp/packer/post-processor/alicloud-import"
|
|
||||||
amazonimportpostprocessor "github.com/hashicorp/packer/post-processor/amazon-import"
|
|
||||||
artificepostprocessor "github.com/hashicorp/packer/post-processor/artifice"
|
|
||||||
checksumpostprocessor "github.com/hashicorp/packer/post-processor/checksum"
|
|
||||||
compresspostprocessor "github.com/hashicorp/packer/post-processor/compress"
|
|
||||||
dockerimportpostprocessor "github.com/hashicorp/packer/post-processor/docker-import"
|
|
||||||
dockerpushpostprocessor "github.com/hashicorp/packer/post-processor/docker-push"
|
|
||||||
dockersavepostprocessor "github.com/hashicorp/packer/post-processor/docker-save"
|
|
||||||
dockertagpostprocessor "github.com/hashicorp/packer/post-processor/docker-tag"
|
|
||||||
googlecomputeexportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-export"
|
|
||||||
googlecomputeimportpostprocessor "github.com/hashicorp/packer/post-processor/googlecompute-import"
|
|
||||||
manifestpostprocessor "github.com/hashicorp/packer/post-processor/manifest"
|
|
||||||
shelllocalpostprocessor "github.com/hashicorp/packer/post-processor/shell-local"
|
|
||||||
vagrantpostprocessor "github.com/hashicorp/packer/post-processor/vagrant"
|
|
||||||
vagrantcloudpostprocessor "github.com/hashicorp/packer/post-processor/vagrant-cloud"
|
|
||||||
vspherepostprocessor "github.com/hashicorp/packer/post-processor/vsphere"
|
vspherepostprocessor "github.com/hashicorp/packer/post-processor/vsphere"
|
||||||
vspheretemplatepostprocessor "github.com/hashicorp/packer/post-processor/vsphere-template"
|
vspheretemplatepostprocessor "github.com/hashicorp/packer/post-processor/vsphere-template"
|
||||||
ansibleprovisioner "github.com/hashicorp/packer/provisioner/ansible"
|
|
||||||
ansiblelocalprovisioner "github.com/hashicorp/packer/provisioner/ansible-local"
|
|
||||||
breakpointprovisioner "github.com/hashicorp/packer/provisioner/breakpoint"
|
|
||||||
chefclientprovisioner "github.com/hashicorp/packer/provisioner/chef-client"
|
|
||||||
chefsoloprovisioner "github.com/hashicorp/packer/provisioner/chef-solo"
|
|
||||||
convergeprovisioner "github.com/hashicorp/packer/provisioner/converge"
|
|
||||||
fileprovisioner "github.com/hashicorp/packer/provisioner/file"
|
|
||||||
powershellprovisioner "github.com/hashicorp/packer/provisioner/powershell"
|
|
||||||
puppetmasterlessprovisioner "github.com/hashicorp/packer/provisioner/puppet-masterless"
|
|
||||||
puppetserverprovisioner "github.com/hashicorp/packer/provisioner/puppet-server"
|
|
||||||
saltmasterlessprovisioner "github.com/hashicorp/packer/provisioner/salt-masterless"
|
|
||||||
shellprovisioner "github.com/hashicorp/packer/provisioner/shell"
|
|
||||||
shelllocalprovisioner "github.com/hashicorp/packer/provisioner/shell-local"
|
|
||||||
windowsrestartprovisioner "github.com/hashicorp/packer/provisioner/windows-restart"
|
windowsrestartprovisioner "github.com/hashicorp/packer/provisioner/windows-restart"
|
||||||
windowsshellprovisioner "github.com/hashicorp/packer/provisioner/windows-shell"
|
windowsshellprovisioner "github.com/hashicorp/packer/provisioner/windows-shell"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type PluginCommand struct {
|
type PluginCommand struct {
|
||||||
|
@ -85,79 +86,82 @@ type PluginCommand struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var Builders = map[string]packer.Builder{
|
var Builders = map[string]packer.Builder{
|
||||||
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
"alicloud-ecs": new(alicloudecsbuilder.Builder),
|
||||||
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
"amazon-chroot": new(amazonchrootbuilder.Builder),
|
||||||
"amazon-ebs": new(amazonebsbuilder.Builder),
|
"amazon-ebs": new(amazonebsbuilder.Builder),
|
||||||
"amazon-ebssurrogate": new(amazonebssurrogatebuilder.Builder),
|
"amazon-ebssurrogate": new(amazonebssurrogatebuilder.Builder),
|
||||||
"amazon-ebsvolume": new(amazonebsvolumebuilder.Builder),
|
"amazon-ebsvolume": new(amazonebsvolumebuilder.Builder),
|
||||||
"amazon-instance": new(amazoninstancebuilder.Builder),
|
"amazon-instance": new(amazoninstancebuilder.Builder),
|
||||||
"azure-arm": new(azurearmbuilder.Builder),
|
"azure-arm": new(azurearmbuilder.Builder),
|
||||||
"cloudstack": new(cloudstackbuilder.Builder),
|
"cloudstack": new(cloudstackbuilder.Builder),
|
||||||
"digitalocean": new(digitaloceanbuilder.Builder),
|
"digitalocean": new(digitaloceanbuilder.Builder),
|
||||||
"docker": new(dockerbuilder.Builder),
|
"docker": new(dockerbuilder.Builder),
|
||||||
"file": new(filebuilder.Builder),
|
"file": new(filebuilder.Builder),
|
||||||
"googlecompute": new(googlecomputebuilder.Builder),
|
"googlecompute": new(googlecomputebuilder.Builder),
|
||||||
"hcloud": new(hcloudbuilder.Builder),
|
"hcloud": new(hcloudbuilder.Builder),
|
||||||
"hyperv-iso": new(hypervisobuilder.Builder),
|
"hyperv-iso": new(hypervisobuilder.Builder),
|
||||||
"hyperv-vmcx": new(hypervvmcxbuilder.Builder),
|
"hyperv-vmcx": new(hypervvmcxbuilder.Builder),
|
||||||
"lxc": new(lxcbuilder.Builder),
|
"lxc": new(lxcbuilder.Builder),
|
||||||
"lxd": new(lxdbuilder.Builder),
|
"lxd": new(lxdbuilder.Builder),
|
||||||
"ncloud": new(ncloudbuilder.Builder),
|
"ncloud": new(ncloudbuilder.Builder),
|
||||||
"null": new(nullbuilder.Builder),
|
"null": new(nullbuilder.Builder),
|
||||||
"oneandone": new(oneandonebuilder.Builder),
|
"oneandone": new(oneandonebuilder.Builder),
|
||||||
"openstack": new(openstackbuilder.Builder),
|
"openstack": new(openstackbuilder.Builder),
|
||||||
"oracle-classic": new(oracleclassicbuilder.Builder),
|
"oracle-classic": new(oracleclassicbuilder.Builder),
|
||||||
"oracle-oci": new(oracleocibuilder.Builder),
|
"oracle-oci": new(oracleocibuilder.Builder),
|
||||||
"parallels-iso": new(parallelsisobuilder.Builder),
|
"parallels-iso": new(parallelsisobuilder.Builder),
|
||||||
"parallels-pvm": new(parallelspvmbuilder.Builder),
|
"parallels-pvm": new(parallelspvmbuilder.Builder),
|
||||||
"profitbricks": new(profitbricksbuilder.Builder),
|
"profitbricks": new(profitbricksbuilder.Builder),
|
||||||
"qemu": new(qemubuilder.Builder),
|
"qemu": new(qemubuilder.Builder),
|
||||||
"scaleway": new(scalewaybuilder.Builder),
|
"scaleway": new(scalewaybuilder.Builder),
|
||||||
"triton": new(tritonbuilder.Builder),
|
"triton": new(tritonbuilder.Builder),
|
||||||
"virtualbox-iso": new(virtualboxisobuilder.Builder),
|
"virtualbox-iso": new(virtualboxisobuilder.Builder),
|
||||||
"virtualbox-ovf": new(virtualboxovfbuilder.Builder),
|
"virtualbox-ovf": new(virtualboxovfbuilder.Builder),
|
||||||
"vmware-iso": new(vmwareisobuilder.Builder),
|
"vmware-iso": new(vmwareisobuilder.Builder),
|
||||||
"vmware-vmx": new(vmwarevmxbuilder.Builder),
|
"vmware-vmx": new(vmwarevmxbuilder.Builder),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var Provisioners = map[string]packer.Provisioner{
|
var Provisioners = map[string]packer.Provisioner{
|
||||||
"ansible": new(ansibleprovisioner.Provisioner),
|
"ansible": new(ansibleprovisioner.Provisioner),
|
||||||
"ansible-local": new(ansiblelocalprovisioner.Provisioner),
|
"ansible-local": new(ansiblelocalprovisioner.Provisioner),
|
||||||
"breakpoint": new(breakpointprovisioner.Provisioner),
|
"breakpoint": new(breakpointprovisioner.Provisioner),
|
||||||
"chef-client": new(chefclientprovisioner.Provisioner),
|
"chef-client": new(chefclientprovisioner.Provisioner),
|
||||||
"chef-solo": new(chefsoloprovisioner.Provisioner),
|
"chef-solo": new(chefsoloprovisioner.Provisioner),
|
||||||
"converge": new(convergeprovisioner.Provisioner),
|
"converge": new(convergeprovisioner.Provisioner),
|
||||||
"file": new(fileprovisioner.Provisioner),
|
"file": new(fileprovisioner.Provisioner),
|
||||||
"powershell": new(powershellprovisioner.Provisioner),
|
"powershell": new(powershellprovisioner.Provisioner),
|
||||||
"puppet-masterless": new(puppetmasterlessprovisioner.Provisioner),
|
"puppet-masterless": new(puppetmasterlessprovisioner.Provisioner),
|
||||||
"puppet-server": new(puppetserverprovisioner.Provisioner),
|
"puppet-server": new(puppetserverprovisioner.Provisioner),
|
||||||
"salt-masterless": new(saltmasterlessprovisioner.Provisioner),
|
"salt-masterless": new(saltmasterlessprovisioner.Provisioner),
|
||||||
"shell": new(shellprovisioner.Provisioner),
|
"shell": new(shellprovisioner.Provisioner),
|
||||||
"shell-local": new(shelllocalprovisioner.Provisioner),
|
"shell-local": new(shelllocalprovisioner.Provisioner),
|
||||||
"windows-restart": new(windowsrestartprovisioner.Provisioner),
|
"windows-restart": new(windowsrestartprovisioner.Provisioner),
|
||||||
"windows-shell": new(windowsshellprovisioner.Provisioner),
|
"windows-shell": new(windowsshellprovisioner.Provisioner),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var PostProcessors = map[string]packer.PostProcessor{
|
var PostProcessors = map[string]packer.PostProcessor{
|
||||||
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
"alicloud-import": new(alicloudimportpostprocessor.PostProcessor),
|
||||||
"amazon-import": new(amazonimportpostprocessor.PostProcessor),
|
"amazon-import": new(amazonimportpostprocessor.PostProcessor),
|
||||||
"artifice": new(artificepostprocessor.PostProcessor),
|
"artifice": new(artificepostprocessor.PostProcessor),
|
||||||
"checksum": new(checksumpostprocessor.PostProcessor),
|
"checksum": new(checksumpostprocessor.PostProcessor),
|
||||||
"compress": new(compresspostprocessor.PostProcessor),
|
"compress": new(compresspostprocessor.PostProcessor),
|
||||||
"docker-import": new(dockerimportpostprocessor.PostProcessor),
|
"docker-import": new(dockerimportpostprocessor.PostProcessor),
|
||||||
"docker-push": new(dockerpushpostprocessor.PostProcessor),
|
"docker-push": new(dockerpushpostprocessor.PostProcessor),
|
||||||
"docker-save": new(dockersavepostprocessor.PostProcessor),
|
"docker-save": new(dockersavepostprocessor.PostProcessor),
|
||||||
"docker-tag": new(dockertagpostprocessor.PostProcessor),
|
"docker-tag": new(dockertagpostprocessor.PostProcessor),
|
||||||
"googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor),
|
"googlecompute-export": new(googlecomputeexportpostprocessor.PostProcessor),
|
||||||
"googlecompute-import": new(googlecomputeimportpostprocessor.PostProcessor),
|
"googlecompute-import": new(googlecomputeimportpostprocessor.PostProcessor),
|
||||||
"manifest": new(manifestpostprocessor.PostProcessor),
|
"manifest": new(manifestpostprocessor.PostProcessor),
|
||||||
"shell-local": new(shelllocalpostprocessor.PostProcessor),
|
"shell-local": new(shelllocalpostprocessor.PostProcessor),
|
||||||
"vagrant": new(vagrantpostprocessor.PostProcessor),
|
"vagrant": new(vagrantpostprocessor.PostProcessor),
|
||||||
"vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor),
|
"vagrant-cloud": new(vagrantcloudpostprocessor.PostProcessor),
|
||||||
"vsphere": new(vspherepostprocessor.PostProcessor),
|
"vsphere": new(vspherepostprocessor.PostProcessor),
|
||||||
"vsphere-template": new(vspheretemplatepostprocessor.PostProcessor),
|
"vsphere-template": new(vspheretemplatepostprocessor.PostProcessor),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)")
|
var pluginRegexp = regexp.MustCompile("packer-(builder|post-processor|provisioner)-(.+)")
|
||||||
|
|
||||||
func (c *PluginCommand) Run(args []string) int {
|
func (c *PluginCommand) Run(args []string) int {
|
||||||
|
|
|
@ -1190,7 +1190,6 @@ func newParser(filename string, b []byte, opts ...Option) *parser {
|
||||||
Stats: &stats,
|
Stats: &stats,
|
||||||
// start rule is rule [0] unless an alternate entrypoint is specified
|
// start rule is rule [0] unless an alternate entrypoint is specified
|
||||||
entrypoint: g.rules[0].name,
|
entrypoint: g.rules[0].name,
|
||||||
emptyState: make(storeDict),
|
|
||||||
}
|
}
|
||||||
p.setOptions(opts)
|
p.setOptions(opts)
|
||||||
|
|
||||||
|
@ -1279,9 +1278,6 @@ type parser struct {
|
||||||
choiceNoMatch string
|
choiceNoMatch string
|
||||||
// recovery expression stack, keeps track of the currently available recovery expression, these are traversed in reverse
|
// recovery expression stack, keeps track of the currently available recovery expression, these are traversed in reverse
|
||||||
recoveryStack []map[string]interface{}
|
recoveryStack []map[string]interface{}
|
||||||
|
|
||||||
// emptyState contains an empty storeDict, which is used to optimize cloneState if global "state" store is not used.
|
|
||||||
emptyState storeDict
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// push a variable set on the vstack.
|
// push a variable set on the vstack.
|
||||||
|
@ -1455,13 +1451,6 @@ func (p *parser) cloneState() storeDict {
|
||||||
defer p.out(p.in("cloneState"))
|
defer p.out(p.in("cloneState"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(p.cur.state) == 0 {
|
|
||||||
if len(p.emptyState) > 0 {
|
|
||||||
p.emptyState = make(storeDict)
|
|
||||||
}
|
|
||||||
return p.emptyState
|
|
||||||
}
|
|
||||||
|
|
||||||
state := make(storeDict, len(p.cur.state))
|
state := make(storeDict, len(p.cur.state))
|
||||||
for k, v := range p.cur.state {
|
for k, v := range p.cur.state {
|
||||||
if c, ok := v.(Cloner); ok {
|
if c, ok := v.(Cloner); ok {
|
||||||
|
|
|
@ -25,11 +25,20 @@ registry.
|
||||||
The configuration for this post-processor only requires a `repository`, a `tag`
|
The configuration for this post-processor only requires a `repository`, a `tag`
|
||||||
is optional.
|
is optional.
|
||||||
|
|
||||||
|
### Required:
|
||||||
|
|
||||||
- `repository` (string) - The repository of the imported image.
|
- `repository` (string) - The repository of the imported image.
|
||||||
|
|
||||||
- `tag` (string) - The tag for the imported image. By default this is not
|
- `tag` (string) - The tag for the imported image. By default this is not
|
||||||
set.
|
set.
|
||||||
|
|
||||||
|
### Optional:
|
||||||
|
|
||||||
|
- `changes` (array of strings) - Dockerfile instructions to add to the
|
||||||
|
commit. Example of instructions are `CMD`, `ENTRYPOINT`, `ENV`, and
|
||||||
|
`EXPOSE`. Example: `[ "USER ubuntu", "WORKDIR /app", "EXPOSE 8080" ]`
|
||||||
|
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
An example is shown below, showing only the post-processor configuration:
|
An example is shown below, showing only the post-processor configuration:
|
||||||
|
@ -48,3 +57,68 @@ into the local Docker process with a name of `hashicorp/packer:0.7`.
|
||||||
Following this, you can use the
|
Following this, you can use the
|
||||||
[docker-push](/docs/post-processors/docker-push.html) post-processor to push it
|
[docker-push](/docs/post-processors/docker-push.html) post-processor to push it
|
||||||
to a registry, if you want.
|
to a registry, if you want.
|
||||||
|
|
||||||
|
## Changing Metadata
|
||||||
|
|
||||||
|
Below is an example using the changes argument of the post-processor. This
|
||||||
|
feature allows the tarball metadata to be changed when imported into the
|
||||||
|
Docker environment. It is derived from the `docker import --change` command
|
||||||
|
line [option to
|
||||||
|
Docker](https://docs.docker.com/engine/reference/commandline/import/).
|
||||||
|
|
||||||
|
Example uses of all of the options, assuming one is building an NGINX image
|
||||||
|
from ubuntu as an simple example:
|
||||||
|
|
||||||
|
``` json
|
||||||
|
{
|
||||||
|
"type": "docker-import",
|
||||||
|
"repository": "local/centos6",
|
||||||
|
"tag": "latest",
|
||||||
|
"changes": [
|
||||||
|
"USER www-data",
|
||||||
|
"WORKDIR /var/www",
|
||||||
|
"ENV HOSTNAME www.example.com",
|
||||||
|
"VOLUME /test1 /test2",
|
||||||
|
"EXPOSE 80 443",
|
||||||
|
"LABEL version=1.0",
|
||||||
|
"ONBUILD RUN date",
|
||||||
|
"CMD [\"nginx\", \"-g\", \"daemon off;\"]",
|
||||||
|
"ENTRYPOINT /var/www/start.sh"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Allowed metadata fields that can be changed are:
|
||||||
|
|
||||||
|
- CMD
|
||||||
|
- String, supports both array (escaped) and string form
|
||||||
|
- EX: `"CMD [\"nginx\", \"-g\", \"daemon off;\"]"`
|
||||||
|
- EX: `"CMD nginx -g daemon off;"`
|
||||||
|
- ENTRYPOINT
|
||||||
|
- String
|
||||||
|
- EX: `"ENTRYPOINT /var/www/start.sh"`
|
||||||
|
- ENV
|
||||||
|
- String, note there is no equal sign:
|
||||||
|
- EX: `"ENV HOSTNAME www.example.com"` not
|
||||||
|
`"ENV HOSTNAME=www.example.com"`
|
||||||
|
- EXPOSE
|
||||||
|
- String, space separated ports
|
||||||
|
- EX: `"EXPOSE 80 443"`
|
||||||
|
- LABEL
|
||||||
|
- String, space separated key=value pairs
|
||||||
|
- EX: `"LABEL version=1.0"`
|
||||||
|
- ONBUILD
|
||||||
|
- String
|
||||||
|
- EX: `"ONBUILD RUN date"`
|
||||||
|
- MAINTAINER
|
||||||
|
- String, deprecated in Docker version 1.13.0
|
||||||
|
- EX: `"MAINTAINER NAME"`
|
||||||
|
- USER
|
||||||
|
- String
|
||||||
|
- EX: `"USER USERNAME"`
|
||||||
|
- VOLUME
|
||||||
|
- String
|
||||||
|
- EX: `"VOLUME FROM TO"`
|
||||||
|
- WORKDIR
|
||||||
|
- String
|
||||||
|
- EX: `"WORKDIR PATH"`
|
||||||
|
|
Loading…
Reference in New Issue