diff options
| author | Joel Challis <git@zvecr.com> | 2019-07-16 09:20:34 +0100 |
|---|---|---|
| committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-07-16 01:20:34 -0700 |
| commit | 29e9caa82bdfe898dd7fca82fcecf0cae2374859 (patch) | |
| tree | ad65f691513580f926465959b5a1169365c77959 /Vagrantfile | |
| parent | a32f7e1a25a8a200d838aa8256ffe39708fbd723 (diff) | |
| download | qmk_firmware-29e9caa82bdfe898dd7fca82fcecf0cae2374859.tar.gz qmk_firmware-29e9caa82bdfe898dd7fca82fcecf0cae2374859.zip | |
Configure Vagrant to use qmk_base_container (#6194)
* Initial conversion of vagrant to use qmkfm/base_container
* Fix vagrant when using docker provider
* Workaround for VirtualBox VM restarts
* Generalise Vagrant docs slightly and add FAQ
Diffstat (limited to 'Vagrantfile')
| -rw-r--r-- | Vagrantfile | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/Vagrantfile b/Vagrantfile index 552711d63..dae4e0d53 100644 --- a/Vagrantfile +++ b/Vagrantfile | |||
| @@ -52,26 +52,37 @@ Vagrant.configure(2) do |config| | |||
| 52 | end | 52 | end |
| 53 | 53 | ||
| 54 | # Docker provider pulls from hub.docker.com respecting docker.image if | 54 | # Docker provider pulls from hub.docker.com respecting docker.image if |
| 55 | # config.vm.box is nil. Note that this bind-mounts from the current dir to | 55 | # config.vm.box is nil. In this case, we adhoc build util/vagrant/Dockerfile. |
| 56 | # Note that this bind-mounts from the current dir to | ||
| 56 | # /vagrant in the guest, so unless your UID is 1000 to match vagrant in the | 57 | # /vagrant in the guest, so unless your UID is 1000 to match vagrant in the |
| 57 | # image, you'll need to: chmod -R a+rw . | 58 | # image, you'll need to: chmod -R a+rw . |
| 58 | config.vm.provider "docker" do |docker, override| | 59 | config.vm.provider "docker" do |docker, override| |
| 59 | override.vm.box = nil | 60 | override.vm.box = nil |
| 60 | docker.image = "jesselang/debian-vagrant:stretch" | 61 | docker.build_dir = "util/vagrant" |
| 61 | docker.has_ssh = true | 62 | docker.has_ssh = true |
| 62 | end | 63 | end |
| 63 | 64 | ||
| 64 | # This script ensures the required packages for AVR programming are installed | 65 | # Unless we are running the docker container directly |
| 65 | # It also ensures the system always gets the latest updates when powered on | 66 | # 1. run container detached on vm |
| 66 | # If this causes issues you can run a 'vagrant destroy' and then | 67 | # 2. attach on 'vagrant ssh' |
| 67 | # add a # before ,run: (or change "always" to "once") and run 'vagrant up' to get a working | 68 | ["virtualbox", "vmware_workstation", "vmware_fusion"].each do |type| |
| 68 | # non-updated box and then attempt to troubleshoot or open a Github issue | 69 | config.vm.provider type do |virt, override| |
| 69 | config.vm.provision "shell", inline: "/vagrant/util/qmk_install.sh", run: "always" | 70 | override.vm.provision "docker" do |d| |
| 71 | d.run "qmkfm/base_container", | ||
| 72 | cmd: "tail -f /dev/null", | ||
| 73 | args: "--privileged -v /dev:/dev -v '/vagrant:/vagrant'" | ||
| 74 | end | ||
| 75 | |||
| 76 | override.vm.provision "shell", inline: <<-SHELL | ||
| 77 | echo 'docker restart qmkfm-base_container && exec docker exec -it qmkfm-base_container /bin/bash -l' >> ~vagrant/.bashrc | ||
| 78 | SHELL | ||
| 79 | end | ||
| 80 | end | ||
| 70 | 81 | ||
| 71 | config.vm.post_up_message = <<-EOT | 82 | config.vm.post_up_message = <<-EOT |
| 72 | 83 | ||
| 73 | Log into the VM using 'vagrant ssh'. QMK directory synchronized with host is | 84 | Log into the environment using 'vagrant ssh'. QMK directory synchronized with |
| 74 | located at /vagrant | 85 | host is located at /vagrant |
| 75 | To compile the .hex files use make command inside this directory, e.g. | 86 | To compile the .hex files use make command inside this directory, e.g. |
| 76 | cd /vagrant | 87 | cd /vagrant |
| 77 | make <keyboard>:default | 88 | make <keyboard>:default |
