Skip to content

Instantly share code, notes, and snippets.

@porty
Created October 15, 2017 05:43
Show Gist options
  • Save porty/ed114e5d7b95e06d76a08f088d1cffce to your computer and use it in GitHub Desktop.
Save porty/ed114e5d7b95e06d76a08f088d1cffce to your computer and use it in GitHub Desktop.
Google Cloud templates, hopefully to build AURs within Docker in a Debian machine
imports:
- path: vm-template.jinja
resources:
- name: aur-builder
type: vm-template.jinja
properties:
project: august-impact-91906
zone: australia-southeast1-c
user: shorty
resources:
- name: {{ env["name"] }}
type: compute.v1.instance
properties:
zone: {{ properties["zone"] }}
machineType: https://www.googleapis.com/compute/v1/projects/{{ properties["project"] }}/zones/{{ properties["zone"] }}/machineTypes/f1-micro
disks:
- deviceName: boot
type: PERSISTENT
boot: true
autoDelete: true
initializeParams:
sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-9
networkInterfaces:
- network: https://www.googleapis.com/compute/v1/projects/{{ properties["project"] }}/global/networks/default
accessConfigs:
- name: External NAT
type: ONE_TO_ONE_NAT
metadata:
items:
- key: startup-script
value: |
#!/bin/bash
set -euo pipefail
apt-get update
apt-get install -y htop lsof
apt-get -y install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce
usermod -a -G docker {{ properties["user"] }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment