# vi: set ft=ruby :
Vagrant.configure("2") do |config|
    config.vm.define "debian" do |debian|
        debian.vm.box = "debian/bullseye64"
    end
    config.vm.define "ubuntu" do |ubuntu|
        ubuntu.vm.box = "ubuntu/focal64"
    end
    config.vm.synced_folder ".", "/vagrant", disabled: true
    config.vm.provision "shell", inline: <<-SHELL
        apt-get update
        . /etc/os-release
        if [ "$ID" = 'ubuntu' ]
        then
            echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
            curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | apt-key add -
            apt-get update
        fi
        apt-get install -y podman curl
        podman version
        podman system info
        curl -L https://git.shore.co.il/shore/toolbox-build/-/jobs/artifacts/master/raw/toolbox.tar.gz?job=build | tar -xzC /usr/local/
        runuser -u vagrant -- podman build --tag my-image https://git.shore.co.il/snippets/12.git
        runuser -u vagrant -- /bin/sh -c 'podman container inspect my-image || toolbox create --image my-image'
    SHELL
end