Skip to content

Commit

Permalink
add: packer script
Browse files Browse the repository at this point in the history
  • Loading branch information
Silvija Tovernic committed Sep 19, 2024
1 parent 709cb0e commit d4e6918
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion images/packer/image-factory-vm/build.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,42 @@ build {
]

provisioner "shell" {
execute_command = "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'"

inline = [
"echo Hi!"
"apt-get update",
"apt-get upgrade -y",
"/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync",

# Install required packages
"apt-get install --no-install-recommends -y \\",
"apt-transport-https \\",
"buildah \\",
"ca-certificates \\",
"curl \\",
"git \\",
"gnupg \\",
"jq \\",
"libcap2-bin \\",
"lsb-release \\",
"podman \\",
"slirp4netns \\",
"software-properties-common \\",
"unzip \\",
"vim \\",
"wget",

# Clean up
"rm -rf /var/lib/apt/lists/*",

# Install Azure CLI
"curl -sL https://aka.ms/InstallAzureCLIDeb | bash",

# Set up Trivy repository and install Trivy
"wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | apt-key add -",
"echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | tee -a /etc/apt/sources.list.d/trivy.list",
"apt-get update",
"apt-get install -y trivy"
]
}
}

0 comments on commit d4e6918

Please sign in to comment.