-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
69 lines (55 loc) · 2.26 KB
/
Vagrantfile
File metadata and controls
69 lines (55 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64"
config.vm.hostname = "ubunti"
# Forward SSH (optional, still can use vagrant ssh)
config.vm.network "forwarded_port", guest: 22, host: 2222, auto_correct: true
# VM resources
config.vm.provider "virtualbox" do |vb|
vb.name = "ubunti"
vb.memory = "8192"
vb.cpus = 2
# TODO: Resize disk to 100 GB (dynamic)
# vb.customize ["modifyhd", :id, "--resize", 100000]
end
# Provisioning script
config.vm.provision "shell", inline: <<-SHELL
set -eux
# Update packages
sudo apt-get update -y
sudo apt-get install -y git curl bzip2 vim byobu fish software-properties-common python3-pip datalad git-annex
# Install Miniforge (Conda base env)
if [ ! -d "/opt/conda" ]; then
curl -L -o Miniforge3.sh \
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
sudo bash Miniforge3.sh -b -p /opt/conda
rm Miniforge3.sh
# Make Conda available system-wide
sudo ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
echo ". /opt/conda/etc/profile.d/conda.sh" >> /home/vagrant/.bashrc
echo "conda activate base" >> /home/vagrant/.bashrc
sudo chown -R vagrant:vagrant /opt/conda
fi
# Auto-start byobu for vagrant ssh sessions
grep -qxF '[[ $- == *i* ]] && byobu' /home/vagrant/.bashrc || \
echo '[[ $- == *i* ]] && byobu' >> /home/vagrant/.bashrc
# Add fish to /etc/shells
if ! grep -qxF '/usr/bin/fish' /etc/shells; then
echo '/usr/bin/fish' | sudo tee -a /etc/shells
fi
# Configure Conda
/opt/conda/bin/conda config --system --add channels conda-forge
/opt/conda/bin/conda config --system --set channel_priority strict
/opt/conda/bin/conda config --system --set auto_activate_base true
/opt/conda/bin/conda config --system --set show_channel_urls true
/opt/conda/bin/conda config --system --set auto_update_conda true
# Install Podman
sudo apt-get install -y podman
# Enable Podman socket for rootless usage
systemctl --user enable podman.socket || true
# Install podman-compose
sudo pip3 install podman-compose
# Verify installations
podman --version
podman-compose --version
SHELL
end