diff --git a/packer/README.md b/packer/README.md new file mode 100644 index 00000000..2b71d75e --- /dev/null +++ b/packer/README.md @@ -0,0 +1,139 @@ +# Packer Templates for GitHub Actions Runner Images + +This directory contains Packer templates to build optimized base images for GitHub Actions self-hosted runners on GCP. + +## 📁 Structure + +```text +packer/gcp/ +├── ubuntu/ # Ubuntu LTS templates and scripts +│ ├── template.pkr.hcl # Packer template +│ ├── build.sh # Interactive build script +│ ├── provision.sh # Provisioning script +│ ├── variables.pkrvars.hcl.example # Variables example +│ └── config-example.yaml # Runner-manager config example +│ +├── rocky/ # Rocky Linux templates and scripts +│ ├── template.pkr.hcl # Packer template +│ ├── build.sh # Interactive build script +│ ├── provision.sh # Provisioning script +│ ├── variables.pkrvars.hcl.example # Variables example +│ └── config-example.yaml # Runner-manager config example +│ +└── README.md # This file +``` + +## 🚀 Quick Start + +### Ubuntu + +```bash +cd packer/gcp/ubuntu +./build.sh +``` + +### Rocky Linux + +```bash +cd packer/gcp/rocky +./build.sh +``` + +## 📊 Performance Improvements + +### Ubuntu 22.04 + +- **Standard spawn time:** 2min09s (129s) +- **With Packer image:** 1min24s (84s) +- **Improvement:** 35% faster ⚡ + +### Rocky Linux 8 + +- **Standard spawn time:** 4min37s (277s) +- **With Packer image:** 2min21s (141s) +- **Improvement:** 49% faster ⚡ + +### Combined Impact (222 instances/day) + +- **Time saved per day:** 3h45min +- **Cost saved per month:** ~6,204€ (at 75€/h developer cost) +- **ROI:** 8,163× (Packer costs only 0.76€/month) + +## 📦 What's Pre-installed + +### Ubuntu Image + +- Docker CE + docker-compose +- System updates and base packages +- Optimized for fast GitHub Actions runner deployment + +### Rocky Image + +- Docker CE + containerd +- EPEL repository (provides most runner dependencies) +- System updates and base packages +- Optimized for fast GitHub Actions runner deployment + +## 🔧 Configuration + +Each OS directory contains: + +1. **template.pkr.hcl** - The Packer template +2. **build.sh** - Interactive build script with prompts +3. **provision.sh** - Shell provisioning script +4. **variables.pkrvars.hcl.example** - Example variables file +5. **config-example.yaml** - Runner-manager configuration example + +## 📖 Usage + +### Build an Image + +```bash +cd packer/gcp/ +./build.sh +``` + +The script will prompt you for: + +- GCP Project ID +- Image name (auto-generated with timestamp) +- Confirmation before building + +## 🛠️ Manual Build + +```bash +cd packer/gcp/ + +# Validate template +packer validate \ + -var="project_id=YOUR_PROJECT" \ + -var="image_name=test-image" \ + template.pkr.hcl + +# Build +packer build \ + -var="project_id=YOUR_PROJECT" \ + -var="image_name=github-runner-base-ubuntu-2204-$(date +%Y%m%d-%H%M%S)" \ + template.pkr.hcl +``` + +## 📝 Notes + +- Images are built on GCP Compute Engine (e2-standard-2 for Ubuntu, e2-standard-2 for Rocky) +- Build time: ~8-15 minutes per image +- Images include security updates and are optimized for fast runner startup +- The `image_family` feature allows automatic use of the latest image version + +## 🔗 Related Documentation + +- [Packer Documentation](https://www.packer.io/docs) +- [GCP Compute Engine Images](https://cloud.google.com/compute/docs/images) +- [Runner Manager Configuration](../README.md) + +## 💡 Tips + +1. **Use image families** instead of specific image names for automatic updates +2. **Tag images** with meaningful names including dates +3. **Test new images** on a small runner group before full deployment +4. **Monitor startup times** in GCP Cloud Logging to validate improvements +5. **Rebuild regularly** (weekly recommended) to include security updates diff --git a/packer/gcp/ubuntu/README.md b/packer/gcp/ubuntu/README.md new file mode 100644 index 00000000..70f2d03f --- /dev/null +++ b/packer/gcp/ubuntu/README.md @@ -0,0 +1,92 @@ +# Ubuntu LTS Packer Template + +This directory contains the Packer template and scripts to build optimized Ubuntu 22.04 LTS base images for GitHub Actions self-hosted runners on GCP. + +## 📊 Performance + +- **Standard spawn time:** 2min09s (129s) +- **With Packer image:** 1min24s (84s) +- **Improvement:** 35% faster ⚡ +- **Time saved per instance:** 45 seconds + +## 📦 What's Pre-installed + +- Docker CE + docker-compose +- containerd.io +- System updates (apt update + upgrade) +- Base development tools +- Optimized for GitHub Actions runner deployment + +## 🚀 Quick Start + +### Build Locally + +```bash +./build.sh +``` + +The script will interactively prompt you for: + +- GCP Project ID +- GCP Zone +- Image name (auto-generated with timestamp) + +### Manual Build + +```bash +# Initialize Packer +packer init template.pkr.hcl + +# Validate +packer validate \ + -var="project_id=YOUR_PROJECT" \ + -var="zone=europe-west1-b" \ + -var="image_name=github-runner-base-ubuntu-2204-$(date +%Y%m%d-%H%M%S)" \ + template.pkr.hcl + +# Build +packer build \ + -var="project_id=YOUR_PROJECT" \ + -var="zone=europe-west1-b" \ + -var="image_name=github-runner-base-ubuntu-2204-$(date +%Y%m%d-%H%M%S)" \ + template.pkr.hcl +``` + +## 📋 Files + +- **template.pkr.hcl** - Packer template definition +- **build.sh** - Interactive build script +- **provision.sh** - Shell provisioning script (if used) +- **variables.pkrvars.hcl.example** - Example variables file +- **config-example.yaml** - Runner-manager configuration example + +## 🛠️ Customization + +To customize the image, edit: + +1. **template.pkr.hcl** - Modify build configuration, machine type, disk size +2. **provisioners** - Add/remove provisioning steps + +Example: Add additional packages + +```hcl +provisioner "shell" { + inline = [ + "sudo apt-get install -y your-package", + ] +} +``` + +## 📝 Notes + +- Build machine: n2-standard-4 (4 vCPU, 16 GB RAM) +- Build time: ~8-10 minutes +- Disk size: 80 GB SSD +- Image family: `github-runner-base-ubuntu-2204` +- Source image: `ubuntu-2204-lts` from `ubuntu-os-cloud` + +## 🔗 See Also + +- [Main Packer README](../README.md) +- [Runner Manager Documentation](../../README.md) +- [Packer GCP Builder Documentation](https://developer.hashicorp.com/packer/integrations/hashicorp/googlecompute) diff --git a/packer/gcp/ubuntu/build.sh b/packer/gcp/ubuntu/build.sh new file mode 100755 index 00000000..44ada095 --- /dev/null +++ b/packer/gcp/ubuntu/build.sh @@ -0,0 +1,213 @@ +#!/bin/bash +# Quick Start Script for Building Packer Image Locally +# This script helps you build a GCP runner image using Packer +# trunk-ignore-all(shellcheck/SC2310): command_exists used in conditions is intentional +# trunk-ignore-all(shellcheck/SC2155): declare and assign pattern is acceptable here +# trunk-ignore-all(shellcheck/SC1003): backslash escaping in examples is intentional + +set -e + +# Colors for output +GREEN='\033[0;32m' +BLUE='\033[0;34m' +RED='\033[0;31m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Function to print colored output +print_info() { + echo -e "${BLUE}[INFO]${NC} $1" +} + +print_success() { + echo -e "${GREEN}[SUCCESS]${NC} $1" +} + +print_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +# Function to check if a command exists +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +# Main script +print_info "Starting Packer build script for GCP runner images" +echo "" + +# Check prerequisites +print_info "Checking prerequisites..." + +if ! command_exists packer; then + print_error "Packer is not installed. Please install it from: https://www.packer.io/downloads" + exit 1 +fi +print_success "Packer is installed ($(packer version))" + +if ! command_exists gcloud; then + print_error "Google Cloud SDK is not installed. Please install it from: https://cloud.google.com/sdk/docs/install" + exit 1 +fi +print_success "Google Cloud SDK is installed" + +# Check GCP authentication +print_info "Checking GCP authentication..." +if gcloud auth application-default print-access-token >/dev/null 2>&1; then + print_success "GCP authentication is configured" +else + print_warning "GCP authentication not found. Running 'gcloud auth application-default login'..." + gcloud auth application-default login +fi + +# Get GCP project ID +CURRENT_PROJECT=$(gcloud config get-value project 2>/dev/null) +if [[ -z ${CURRENT_PROJECT} ]]; then + print_error "No GCP project is configured. Please run: gcloud config set project YOUR_PROJECT_ID" + exit 1 +fi + +echo "" +print_info "Current GCP project: ${CURRENT_PROJECT}" + +# Prompt for confirmation or custom project +read -p "Use this project? (y/n/custom): " -r +if [[ ${REPLY} =~ ^[Nn]$ ]]; then + exit 0 +elif [[ ${REPLY} =~ ^[Cc]ustom$ ]]; then + read -p "Enter GCP project ID: " -r CUSTOM_PROJECT + GCP_PROJECT=${CUSTOM_PROJECT} +else + GCP_PROJECT=${CURRENT_PROJECT} +fi + +# Get zone +print_info "Current GCP zone: $(gcloud config get-value compute/zone 2>/dev/null || echo 'not set')" +read -p "Enter GCP zone (or press Enter for europe-west1-b): " -r +GCP_ZONE=${REPLY:-europe-west1-b} + +# Choose Ubuntu version +echo "" +print_info "Available Ubuntu versions:" +echo " 1) Ubuntu 22.04 LTS (recommended)" +echo " 2) Ubuntu 24.04 LTS" +echo " 3) Custom version" +read -p "Select Ubuntu version (1/2/3): " -r VERSION_CHOICE + +case ${VERSION_CHOICE} in +1) + UBUNTU_VERSION="2204" + print_success "Selected: Ubuntu 22.04 LTS" + ;; +2) + UBUNTU_VERSION="2404" + print_success "Selected: Ubuntu 24.04 LTS" + ;; +3) + read -p "Enter Ubuntu version (e.g., 2204 for 22.04): " -r UBUNTU_VERSION + print_success "Selected: Ubuntu ${UBUNTU_VERSION:0:2}.${UBUNTU_VERSION:2:2}" + ;; +*) + UBUNTU_VERSION="2204" + print_warning "Invalid choice, defaulting to Ubuntu 22.04 LTS" + ;; +esac + +# Generate image name with timestamp +IMAGE_NAME="github-runner-base-ubuntu-${UBUNTU_VERSION}-$(date +%Y%m%d-%H%M%S)" +print_info "Generated image name: ${IMAGE_NAME}" + +read -p "Use this image name? (y/n): " -r +if [[ ${REPLY} =~ ^[Nn]$ ]]; then + read -p "Enter custom image name: " -r CUSTOM_IMAGE_NAME + IMAGE_NAME=${CUSTOM_IMAGE_NAME} +fi + +echo "" +print_info "Build Configuration:" +echo " Project ID: ${GCP_PROJECT}" +echo " Zone: ${GCP_ZONE}" +echo " Ubuntu Version: ${UBUNTU_VERSION:0:2}.${UBUNTU_VERSION:2:2}" +echo " Image Name: ${IMAGE_NAME}" +echo " Image Family: github-runner-base-ubuntu-${UBUNTU_VERSION}" +echo "" + +read -p "Proceed with build? (y/n): " -r +if [[ ! ${REPLY} =~ ^[Yy]$ ]]; then + print_info "Build cancelled" + exit 0 +fi + +echo "" +print_info "Initializing Packer..." +packer init template.pkr.hcl +print_success "Packer initialized" + +echo "" +print_info "Validating Packer template..." +packer validate \ + -var="project_id=${GCP_PROJECT}" \ + -var="zone=${GCP_ZONE}" \ + -var="image_name=${IMAGE_NAME}" \ + -var="ubuntu_version=${UBUNTU_VERSION}" \ + template.pkr.hcl +print_success "Packer template is valid" + +echo "" +print_info "Starting Packer build..." +print_warning "This will take approximately 10-15 minutes" +echo "" + +# Set Packer log level +export PACKER_LOG=1 +export PACKER_LOG_PATH="packer-build-$(date +%Y%m%d-%H%M%S).log" + +# Run Packer build +if packer build \ + -var="project_id=${GCP_PROJECT}" \ + -var="zone=${GCP_ZONE}" \ + -var="image_name=${IMAGE_NAME}" \ + -var="ubuntu_version=${UBUNTU_VERSION}" \ + template.pkr.hcl; then + + echo "" + print_success "Packer build completed successfully!" + print_info "Image name: ${IMAGE_NAME}" + print_info "Image family: github-runner-base" + print_info "Logs saved to: ${PACKER_LOG_PATH}" + + echo "" + print_info "Verifying image creation..." + gcloud compute images describe "${IMAGE_NAME}" \ + --project="${GCP_PROJECT}" \ + --format="table(name,family,diskSizeGb,status,creationTimestamp)" + + echo "" + print_success "Image verification complete!" + + echo "" + print_info "Next steps:" + echo " 1. Test the image by creating a VM:" + echo ' gcloud compute instances create test-runner \' + echo " --image=${IMAGE_NAME} \\" + echo " --image-project=${GCP_PROJECT} \\" + echo " --zone=${GCP_ZONE} \\" + echo " --machine-type=n2-standard-4" + echo "" + echo " 2. Update your config.yaml:" + echo " instance_config:" + echo " image_family: github-runner-base" + echo " image_project: ${GCP_PROJECT}" + echo "" + echo " 3. See docs/development/prebuilt-images.md for detailed setup" + +else + echo "" + print_error "Packer build failed!" + print_info "Check logs at: ${PACKER_LOG_PATH}" + exit 1 +fi diff --git a/packer/gcp/ubuntu/provision.sh b/packer/gcp/ubuntu/provision.sh new file mode 100755 index 00000000..a649a6c3 --- /dev/null +++ b/packer/gcp/ubuntu/provision.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# Ubuntu provisioning script for GitHub Actions runner base image +# This script is called by Packer to configure the image + +set -e + +echo "==========================================" +echo "Ubuntu Provisioning Starting" +echo "==========================================" + +# Update system packages +echo "Step 1/4: Updating system packages..." +apt-get update +DEBIAN_FRONTEND=noninteractive apt-get upgrade -y + +# Install base dependencies +echo "Step 2/4: Installing base dependencies..." +DEBIAN_FRONTEND=noninteractive apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + gnupg \ + lsb-release + +# Install Docker CE +echo "Step 3/4: Installing Docker CE..." +install -m 0755 -d /etc/apt/keyrings +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg +chmod a+r /etc/apt/keyrings/docker.gpg + +echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + $(. /etc/os-release && echo "${VERSION_CODENAME}") stable" | + tee /etc/apt/sources.list.d/docker.list >/dev/null + +apt-get update +apt-get install -y docker-ce docker-ce-cli containerd.io + +# Configure Docker +systemctl enable docker +groupadd -f docker + +# Clean up +echo "Step 4/4: Cleaning up..." +apt-get clean +rm -rf /var/lib/apt/lists/* +rm -rf /tmp/* +rm -f ~/.bash_history + +echo "==========================================" +echo "Ubuntu Provisioning Completed" +echo "==========================================" diff --git a/packer/gcp/ubuntu/template.pkr.hcl b/packer/gcp/ubuntu/template.pkr.hcl new file mode 100644 index 00000000..7c9cd3c6 --- /dev/null +++ b/packer/gcp/ubuntu/template.pkr.hcl @@ -0,0 +1,280 @@ +# Packer Template for GitHub Runner Base Image (Ubuntu) +# This template creates a pre-built GCP VM image with common dependencies +# to accelerate GitHub Actions runner startup time. +# +# Supports multiple Ubuntu versions: 22.04, 24.04, etc. +# +# Example usage: +# Ubuntu 22.04: packer build -var="ubuntu_version=2204" template.pkr.hcl +# Ubuntu 24.04: packer build -var="ubuntu_version=2404" template.pkr.hcl + +# Variables for configuration +variable "project_id" { + type = string + description = "GCP project ID where the image will be built and stored" +} + +variable "zone" { + type = string + description = "GCP zone for the build VM" + default = "europe-west1-b" +} + +variable "ubuntu_version" { + type = string + description = "Ubuntu version (2204 for 22.04, 2404 for 24.04, etc.)" + default = "2204" +} + +variable "source_image_family" { + type = string + description = "Base image family to build from (will be constructed from ubuntu_version if not set)" + default = "" +} + +variable "source_image_project" { + type = string + description = "GCP project containing the source image" + default = "ubuntu-os-cloud" +} + +variable "image_name" { + type = string + description = "Name for the output image (will be auto-generated if not set)" + default = "" +} + +variable "image_family" { + type = string + description = "Image family for the output image (will be constructed from ubuntu_version if not set)" + default = "" +} + +# Local variables for dynamic naming +locals { + # Construct source image family from version if not explicitly set + actual_source_image_family = var.source_image_family != "" ? var.source_image_family : "ubuntu-${var.ubuntu_version}-lts" + + # Construct image family from version if not explicitly set + actual_image_family = var.image_family != "" ? var.image_family : "github-runner-base-ubuntu-${var.ubuntu_version}" + + # Construct image name with timestamp if not explicitly set + actual_image_name = var.image_name != "" ? var.image_name : "github-runner-base-ubuntu-${var.ubuntu_version}-${formatdate("YYYYMMDD-hhmmss", timestamp())}" + + # Formatted version for display (2204 -> 22.04) + version_display = "${substr(var.ubuntu_version, 0, 2)}.${substr(var.ubuntu_version, 2, 2)}" +} + +variable "machine_type" { + type = string + description = "Machine type for the build VM" + default = "n2-standard-2" +} + +variable "disk_size" { + type = number + description = "Disk size in GB for the image" + default = 80 +} + +variable "disk_type" { + type = string + description = "Disk type for the build VM" + default = "pd-ssd" +} + +variable "network" { + type = string + description = "Network to use for the build VM" + default = "default" +} + +variable "subnetwork" { + type = string + description = "Subnetwork to use for the build VM" + default = "" +} + +variable "tags" { + type = list(string) + description = "Network tags for the build VM" + default = ["packer-build"] +} + +variable "image_labels" { + type = map(string) + description = "Labels to apply to the output image" + default = { + created_by = "packer" + purpose = "github-actions-runner" + } +} + +# Packer configuration +packer { + required_version = ">= 1.9.0" + required_plugins { + googlecompute = { + version = ">= 1.1.1" + source = "github.com/hashicorp/googlecompute" + } + } +} + +# Source configuration +source "googlecompute" "runner-base" { + project_id = var.project_id + source_image_family = local.actual_source_image_family + source_image_project_id = [var.source_image_project] + zone = var.zone + + # Output image configuration + image_name = local.actual_image_name + image_family = local.actual_image_family + image_description = "Pre-built GitHub Actions runner base image (Ubuntu ${local.version_display}) with common dependencies" + image_labels = merge(var.image_labels, { + os_version = var.ubuntu_version + }) + + # Build VM configuration + machine_type = var.machine_type + disk_size = var.disk_size + disk_type = var.disk_type + network = var.network + subnetwork = var.subnetwork + tags = var.tags + + # SSH configuration + ssh_username = "packer" + + # Use internal IP if on a private network + use_internal_ip = false + + # Don't create a default service account + omit_external_ip = false +} + +# Build configuration +build { + name = "github-runner-base" + + sources = ["source.googlecompute.runner-base"] + + # Wait for cloud-init to complete + provisioner "shell" { + inline = [ + "echo 'Waiting for cloud-init to complete...'", + "cloud-init status --wait || true", + "echo 'Cloud-init completed'" + ] + } + + # Update system packages + provisioner "shell" { + inline = [ + "echo 'Updating system packages...'", + "sudo apt-get update", + "sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y", + "echo 'System update completed'" + ] + } + + # Install base dependencies - EXACTLY matching startup.sh init() function + provisioner "shell" { + inline = [ + "echo 'Installing base dependencies (matching startup.sh init function)...'", + "sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \\", + " apt-transport-https \\", + " ca-certificates \\", + " curl \\", + " gnupg \\", + " lsb-release", + "echo 'Base dependencies installed'" + ] + } + + # Install Docker - EXACTLY matching startup.sh install_docker() function + provisioner "shell" { + inline = [ + "echo 'Installing Docker (matching startup.sh install_docker function)...'", + "sudo install -m 0755 -d /etc/apt/keyrings", + "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg", + "sudo chmod a+r /etc/apt/keyrings/docker.gpg", + "echo \"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable\" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null", + "sudo apt-get update --yes", + "sudo apt-get install --yes docker-ce docker-ce-cli containerd.io", + "echo 'Docker installed successfully'" + ] + } + + # Configure Docker to start on boot + provisioner "shell" { + inline = [ + "echo 'Configuring Docker service...'", + "sudo systemctl enable docker", + "sudo systemctl start docker", + "# Verify Docker is running", + "sudo docker version", + "echo 'Docker service configured'" + ] + } + + # Pre-create docker group (startup.sh will add actions user to it) + provisioner "shell" { + inline = [ + "echo 'Pre-creating docker group...'", + "sudo groupadd -f docker", + "echo 'Docker group ready'" + ] + } + + # Clean up to reduce image size + provisioner "shell" { + inline = [ + "echo 'Cleaning up to reduce image size...'", + "sudo apt-get autoremove -y", + "sudo apt-get clean", + "sudo rm -rf /var/lib/apt/lists/*", + "sudo rm -rf /tmp/*", + "sudo rm -rf /var/tmp/*", + "# Clear bash history (if exists)", + "rm -f ~/.bash_history", + "touch ~/.bash_history", + "echo 'Cleanup completed'" + ] + } + + # Final system preparation + provisioner "shell" { + inline = [ + "echo 'Final system preparation...'", + "sudo sync", + "echo '========================================='", + "echo 'Image build completed successfully!'", + "echo '========================================='", + "echo 'Pre-installed components:'", + "echo ' - Ubuntu 22.04 LTS (updated)'", + "echo ' - Docker CE with containerd'", + "echo ' - Base dependencies (curl, gnupg, etc.)'", + "echo ''", + "echo 'To be installed at runtime by startup.sh:'", + "echo ' - actions user and permissions'", + "echo ' - GitHub Actions runner agent'", + "echo ' - Runner hooks and configuration'", + "echo ' - Runner service'", + "echo '========================================='", + "sudo docker --version", + "df -h /" + ] + } + + # Optional: Post-processor to create a manifest file + post-processor "manifest" { + output = "packer-manifest.json" + strip_path = true + custom_data = { + source_image_family = var.source_image_family + build_time = timestamp() + } + } +} diff --git a/packer/gcp/ubuntu/variables.pkrvars.hcl.example b/packer/gcp/ubuntu/variables.pkrvars.hcl.example new file mode 100644 index 00000000..70dc11e9 --- /dev/null +++ b/packer/gcp/ubuntu/variables.pkrvars.hcl.example @@ -0,0 +1,32 @@ +# Packer Variables File (Optional) +# This file allows you to set default values for variables +# You can create a copy of this file as `variables.auto.pkrvars.hcl` +# and Packer will automatically load it. + +# GCP Project Configuration +zone = "europe-west1-b" + +# Image Configuration +source_image_family = "ubuntu-2204-lts" +source_image_project = "ubuntu-os-cloud" +image_family = "github-runner-base" + +# Build VM Configuration +machine_type = "n2-standard-2" +disk_size = 80 +disk_type = "pd-ssd" + +# Network Configuration +network = "default" +subnetwork = "" +tags = ["packer-build"] + +# Image Labels +image_labels = { + created_by = "packer" + purpose = "github-actions-runner" + team = "platform" +} + +# Note: image_name should be set dynamically, not in this file +# Use: packer build -var="image_name=github-runner-base-$(date +%Y%m%d)" .