Skip to content

Instantly share code, notes, and snippets.

@sergeycherepanov
Last active January 23, 2025 21:30
Show Gist options
  • Save sergeycherepanov/e80f3947f46a38767a2e2818ad63141d to your computer and use it in GitHub Desktop.
Save sergeycherepanov/e80f3947f46a38767a2e2818ad63141d to your computer and use it in GitHub Desktop.
images:
- location: https://cloud-images.ubuntu.com/jammy/20250123/jammy-server-cloudimg-amd64.img
arch: x86_64
digest: sha256:dcc6b52c52e309edbeca2d542c8800a8f9a14f355d71b172cbb83d79ca050d55
- location: https://cloud-images.ubuntu.com/jammy/20250123/jammy-server-cloudimg-arm64.img
arch: aarch64
digest: sha256:2478b3da77db16932af22d9a8638b6111ab6c2b893f44104d947e6e89db8c3f2
mounts:
- location: "~"
- location: "/tmp/lima"
writable: true
networks:
- vzNAT: true
provision:
# Disable ssh key delition
- mode: system
script: |
#!/bin/sh
mkdir -p /etc/cloud/cloud.cfg.d
echo "ssh_deletekeys: false" > /etc/cloud/cloud.cfg.d/lima-local.cfg
# Update APT cache
- mode: system
script: |
apt -qqy update
# Install kernel modules
- mode: system
script: |
apt -qqy install linux-modules-extra-$(uname -r);
# Install ZRAM
- mode: system
script: |
apt -qqy install zram-tools
cd /etc/default
sed -i ~s~#PERCENT=.*~PERCENT=50~ zramswap
sed -i ~s~#ALGO=.*~ALGO=lz4~ zramswap; systemctl restart zramswap;
# Configure sshd
- mode: system
script: |
echo 'PasswordAuthentication yes' > /etc/ssh/sshd_config.d/45-lima-settings.conf
service ssh restart;
# Add app user
- mode: system
script: |
useradd -m -s /bin/bash -G sudo app
echo "app ALL=(ALL) ALL" > /etc/sudoers.d/50-app-user
echo app:pass | chpasswd --crypt-method=SHA512;
# Install Docker
- mode: system
script: "curl https://get.docker.com | bash; cat /etc/passwd | grep -v 'nologin\\|false' | awk -F: '$3>=500{print $1}' | xargs -I{} usermod -aG docker {}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment