mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 01:12:31 +00:00
61 lines
2.3 KiB
Ruby
61 lines
2.3 KiB
Ruby
# -*- mode: ruby -*-
|
|
# vi: set ft=ruby :
|
|
|
|
#
|
|
# Vagrantfile to create docker-host-base
|
|
#
|
|
# After build, do "vagrant package --base docker-host-base" to package,
|
|
# and import as box: "vagrant box add --name docker-host-base package.box"
|
|
#
|
|
# To add local docker images into the docker host, configure your local
|
|
# docker client to control the docker daemon on the later running docker-host VM.
|
|
# This box configures docker to listen on any IP on port 2375.
|
|
# You can then also load an existing image, e.g.:
|
|
# "docker load -i px4ros_ros-sitl_no-drcsim_a4209708a04a.tar"
|
|
#
|
|
Vagrant.configure(2) do |config|
|
|
config.vm.box = "ubuntu/trusty64"
|
|
|
|
config.vm.define "docker-host-base"
|
|
|
|
config.vm.provider "virtualbox" do |vb|
|
|
vb.name = "docker-host-base"
|
|
vb.gui = true
|
|
vb.memory = "1024"
|
|
end
|
|
|
|
config.vm.provision "file", source: "config/docker-default", destination: "/home/vagrant/docker-default"
|
|
config.vm.provision "file", source: "config/xsessionrc", destination: "/home/vagrant/.xsessionrc"
|
|
|
|
config.vm.provision "shell", inline: <<-SHELL
|
|
# Update and install apps
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
sudo apt-get update
|
|
sudo apt-get upgrade -y
|
|
sudo apt-get install -y --no-install-recommends ubuntu-desktop
|
|
sudo apt-get install -y gnome-terminal unity-lens-applications
|
|
|
|
# Reset the ssh key (because vagrant regenerates it during provisioning)
|
|
sudo wget --no-check-certificate https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
|
|
sudo chmod 0700 /home/vagrant/.ssh
|
|
sudo chmod 0600 /home/vagrant/.ssh/authorized_keys
|
|
sudo chown -R vagrant /home/vagrant/.ssh
|
|
|
|
# Copy docker config
|
|
sudo mv /home/vagrant/docker-default /etc/default/docker
|
|
|
|
# Enable autologin so docker can start GUI apps
|
|
sudo echo "autologin-user=vagrant" >> /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
|
|
sudo echo "autologin-user-timeout=0" >> /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf
|
|
|
|
# X session RC
|
|
chmod +x /home/vagrant/.xsessionrc
|
|
SHELL
|
|
|
|
config.vm.provision "docker"
|
|
|
|
# Shutdown after provisioning. "vagrant halt" doesn't recognize the original ssh key anymore
|
|
# and would just kill the VM. This might lead to FS inconsistencies (e.g. in the docker DB).
|
|
config.vm.provision "shell", inline: "sudo shutdown -h now"
|
|
end
|