Skip to content

Instantly share code, notes, and snippets.

@phareal
Last active April 23, 2022 22:38
Show Gist options
  • Save phareal/f3d2e2bfc628faa7dd037cc12467bae7 to your computer and use it in GitHub Desktop.
Save phareal/f3d2e2bfc628faa7dd037cc12467bae7 to your computer and use it in GitHub Desktop.
Vagrant file for m1 parralles
# encoding: utf-8
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Box / OS
VAGRANT_BOX = 'jeffnoxon/ubuntu-20.04-arm64'
# Memorable name for your VM
VM_NAME = 'project name'
# VM User — 'vagrant' by default
VM_USER = 'vagrant'
# Username on your Mac
MAC_USER = 'phareal'
# Host folder to sync
HOST_PATH = 'project folder'
# Where to sync to on Guest — 'vagrant' is the default user name
GUEST_PATH = 'guet project folder'
# # VM Port — uncomment this to use NAT instead of DHCP
# VM_PORT = 8080
Vagrant.configure(2) do |config|
# Vagrant box from Hashicorp
config.vm.box = VAGRANT_BOX
# Actual machine name
config.vm.hostname = VM_NAME
# Set VM name in Virtualbox
config.vm.provider :parallels do |vm|
# Auto-update Parallels Tools on the VM (takes a few minutes)
config.vm.box = VAGRANT_BOX
vm.update_guest_tools = true
vm.optimize_power_consumption = true
vm.memory = 6144
vm.cpus = 3
end
#DHCP — comment this out if planning on using NAT instead
#config.vm.network "private_network", type: "dhcp"
config.vm.network :forwarded_port, guest: 80, host: 80
config.vm.network :forwarded_port, guest: 3307, host: 3307
config.vm.network :forwarded_port, guest: 3308, host: 3308
# # Port forwarding — uncomment this to use NAT instead of DHCP
# config.vm.network "forwarded_port", guest: 80, host: VM_PORT
# Sync folder
config.vm.synced_folder HOST_PATH, GUEST_PATH
# Disable default Vagrant folder, use a unique path per project
config.vm.synced_folder '.', '/home/'+VM_USER+'', disabled: true
# SSH
config.vm.provision "file", source: "~/.ssh", destination: "~/.ssh"
# Install package for your VM
config.vm.provision "shell", inline: <<-SHELL
apt-get update -y
apt-get install -y git
apt-get install -y apt-transport-https
apt-get install -y build-essential
apt-get install -y curl
apt-get install -y gnupg-agent
apt-get install -y software-properties-common
apt-get install -y python3-pip
apt-get install -y qemu
apt-get install -y binfmt-support
apt-get install -y qemu-user-static
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=arm64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get update -y
apt-get install -y docker-ce docker-ce-cli containerd.io
pip3 install docker-compose
usermod -aG docker vagrant
newgrp docker
echo "cd /opt/atlas-blue" >> /home/vagrant/.bashrc
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment