Easiest way to copy a single file from host to Vagrant guest?

前端 未结 19 1729
暖寄归人
暖寄归人 2020-12-22 15:15

I have a use case where I occasionally want to copy a single file from my host machine to the Vagrant guest.

I don\'t want to do so via traditional provisioners (Pup

19条回答
  •  [愿得一人]
    2020-12-22 15:16

    What I ended up doing was to keep the file within my vagrant directory (automatically mounted as /vagrant/) and copy it over with a shell provisioner:

    command = "cp #{File.join('/vagrant/', path_within_repo)} #{remote_file}"
    config.vm.provision :shell, :inline => command
    

提交回复
热议问题