Last active
October 27, 2021 14:56
-
-
Save mikerenfro/acccc818d81f0c3a76f52a8b10009e0a to your computer and use it in GitHub Desktop.
Vagrantfile for building Docker images and converting them to Singularity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure("2") do |config| | |
# EPEL has a fairly recent Singularity, no need to build from source | |
# Geerling's box uses LVM, so its root filesystem can be expanded | |
config.vm.box = "geerlingguy/centos7" | |
config.vm.hostname = "docker-singularity" | |
# VM specs (200 GB required for Vitis-AI build, others may need more or less) | |
config.disksize.size = '200GB' | |
config.vm.provider "virtualbox" do |vb| | |
vb.cpus = "4" | |
vb.memory = "16384" | |
end | |
# Expand root partition, get Docker and Singularity runnning | |
config.vm.provision "bootstrap", type: "shell", inline: <<-SHELL | |
yum -q -y update | |
yum -q -y install epel-release yum-utils | |
yum -q -y install cloud-utils-growpart | |
growpart /dev/sda 2 | |
pvresize /dev/sda2 | |
lvextend /dev/centos/root -l +100%FREE | |
xfs_growfs / | |
yum -q -y install singularity | |
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | |
yum -q -y install docker-ce docker-ce-cli containerd.io | |
systemctl start docker && systemctl enable docker | |
SHELL | |
# Build Docker container and convert to Singularity | |
# https://stackoverflow.com/a/60316979 | |
config.vm.provision "build", type: "shell", inline: <<-SHELL | |
( cd /vagrant/ && \ | |
docker build -t local/xfemm -f Dockerfile.xfemm . && \ | |
singularity build --force xfemm.sif docker-daemon://local/xfemm:latest ) | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment