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 /util | |
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 'util')
-rw-r--r-- | util/vagrant/Dockerfile | 33 | ||||
-rw-r--r-- | util/vagrant/readme.md | 12 |
2 files changed, 45 insertions, 0 deletions
diff --git a/util/vagrant/Dockerfile b/util/vagrant/Dockerfile new file mode 100644 index 0000000000..1936ee023a --- /dev/null +++ b/util/vagrant/Dockerfile @@ -0,0 +1,33 @@ +FROM qmkfm/base_container + +# Basic upgrades; install sudo and SSH. +RUN apt-get update && apt-get install --no-install-recommends -y \ + sudo \ + openssh-server \ + && rm -rf /var/lib/apt/lists/* +RUN mkdir /var/run/sshd +RUN sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config +RUN echo 'UseDNS no' >> /etc/ssh/sshd_config + +# Remove the policy file once we're finished installing software. +# This allows invoke-rc.d and friends to work as expected. +RUN rm /usr/sbin/policy-rc.d + +# Add the Vagrant user and necessary passwords. +RUN groupadd vagrant +RUN useradd -c "Vagrant" -g vagrant -d /home/vagrant -m -s /bin/bash vagrant +RUN echo 'root:vagrant' | chpasswd +RUN echo 'vagrant:vagrant' | chpasswd + +# Allow the vagrant user to use sudo without a password. +RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant + +# Install Vagrant's insecure public key so provisioning and 'vagrant ssh' work. +RUN mkdir /home/vagrant/.ssh +ADD https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub /home/vagrant/.ssh/authorized_keys +RUN chmod 0600 /home/vagrant/.ssh/authorized_keys +RUN chown -R vagrant:vagrant /home/vagrant/.ssh +RUN chmod 0700 /home/vagrant/.ssh + +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] diff --git a/util/vagrant/readme.md b/util/vagrant/readme.md new file mode 100644 index 0000000000..e4b870a642 --- /dev/null +++ b/util/vagrant/readme.md @@ -0,0 +1,12 @@ +# QMK Vagrant Utilities + +## Dockerfile +Vagrant-friendly `qmkfm/base_container`. + +In order for the Docker provider and `vagrant ssh` to function the container has a few extra requirements. + +* vagrant user +* ssh server + * configured with expected public key +* sudo + * passwordless for vagrant user |