Add docker container dir to template
This commit is contained in:
parent
43c19b49e0
commit
07f7183b64
|
@ -35,6 +35,7 @@ type Config struct {
|
|||
Author string
|
||||
Changes []string
|
||||
Message string
|
||||
ContainerDir string `mapstructure:"container_dir"`
|
||||
|
||||
// This is used to login to dockerhub to pull a private base container. For
|
||||
// pushing to dockerhub, see the docker post-processors
|
||||
|
@ -112,6 +113,10 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
|
|||
}
|
||||
}
|
||||
|
||||
if c.ContainerDir == "" {
|
||||
c.ContainerDir = "/packer-files"
|
||||
}
|
||||
|
||||
if c.EcrLogin && c.LoginServer == "" {
|
||||
errs = packer.MultiErrorAppend(errs, fmt.Errorf("ECR login requires login server to be provided."))
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ func (s *StepConnectDocker) Run(state multistep.StateBag) multistep.StepAction {
|
|||
comm := &Communicator{
|
||||
ContainerId: containerId,
|
||||
HostDir: tempDir,
|
||||
ContainerDir: "/packer-files",
|
||||
ContainerDir: config.ContainerDir,
|
||||
Version: version,
|
||||
Config: config,
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ func (s *StepRun) Run(state multistep.StateBag) multistep.StepAction {
|
|||
for host, container := range config.Volumes {
|
||||
runConfig.Volumes[host] = container
|
||||
}
|
||||
runConfig.Volumes[tempDir] = "/packer-files"
|
||||
runConfig.Volumes[tempDir] = config.ContainerDir
|
||||
|
||||
ui.Say("Starting docker container...")
|
||||
containerId, err := driver.StartContainer(&runConfig)
|
||||
|
|
Loading…
Reference in New Issue