# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "generic/alpine310"

  config.vm.network :forwarded_port, guest: 22, host: 2228, id: "ssh"

  config.vm.provision "shell", inline: <<-SHELL
    apk update
    apk upgrade
    apk add make
    apk add alpine-sdk
    apk add gcc
    apk add rsync
    apk add socat
    apk add 'go@community>=1.11'
    grep normuser /etc/passwd >/dev/null || adduser -D normuser

    addgroup vagrant abuild
    sudo -u vagrant abuild-keygen -an
    find "/home/vagrant/.abuild" -name '*.rsa.pub' -exec mv {} /etc/apk/keys/ ';'
    chown root:root /etc/apk/keys/*
    sudo -u vagrant abuild checksum
  SHELL
end
