]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/vagrant/Dockerfile
Configure Vagrant to use qmk_base_container (#6194)
[qmk_firmware.git] / util / vagrant / Dockerfile
1 FROM qmkfm/base_container
2
3 # Basic upgrades; install sudo and SSH.
4 RUN apt-get update && apt-get install --no-install-recommends -y \
5         sudo \
6         openssh-server \
7     && rm -rf /var/lib/apt/lists/*
8 RUN mkdir /var/run/sshd
9 RUN sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config
10 RUN echo 'UseDNS no' >> /etc/ssh/sshd_config
11
12 # Remove the policy file once we're finished installing software.
13 # This allows invoke-rc.d and friends to work as expected.
14 RUN rm /usr/sbin/policy-rc.d
15
16 # Add the Vagrant user and necessary passwords.
17 RUN groupadd vagrant
18 RUN useradd -c "Vagrant" -g vagrant -d /home/vagrant -m -s /bin/bash vagrant
19 RUN echo 'root:vagrant' | chpasswd
20 RUN echo 'vagrant:vagrant' | chpasswd
21
22 # Allow the vagrant user to use sudo without a password.
23 RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant
24
25 # Install Vagrant's insecure public key so provisioning and 'vagrant ssh' work.
26 RUN mkdir /home/vagrant/.ssh
27 ADD https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub /home/vagrant/.ssh/authorized_keys
28 RUN chmod 0600 /home/vagrant/.ssh/authorized_keys
29 RUN chown -R vagrant:vagrant /home/vagrant/.ssh
30 RUN chmod 0700 /home/vagrant/.ssh
31
32 EXPOSE 22
33 CMD ["/usr/sbin/sshd", "-D"]