Hi,
I got the same cocern becase I need to install a custon windows 10 vm
with the following:
Windows 10
.NET 4.7.2
.NET Core 2.x
Visual Studio Community 2017
I think the first two I can install it wiht chocolatey. This is my
packer template.
{
"builders": [
{
"type": "virtualbox-iso",
"iso_url": "{{user `iso_url`}}",
"iso_checksum_type": "{{user `iso_checksum_type`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"headless": false,
"guest_additions_mode": "attach",
"boot_wait": "2m",
"communicator": "winrm",
"winrm_username": "vagrant",
"winrm_password": "vagrant",
"winrm_timeout": "5h",
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer
Shutdown\"",
"shutdown_timeout": "15m",
"guest_os_type": "Windows81_64",
"disk_size": 61440,
"floppy_files": [
"{{user `autounattend`}}",
"{{user `autounattend`}}",
"./floppy/WindowsPowershell.lnk",
"./floppy/PinTo10.exe",
"./scripts/fixnetwork.ps1",
"./scripts/disable-screensaver.ps1",
"./scripts/disable-winrm.ps1",
"./scripts/enable-winrm.ps1",
"./scripts/microsoft-updates.bat",
"./scripts/win-updates.ps1",
],
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"2048"
],
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2"
]
]
}
],
"provisioners": [
{
"scripts": [
"./scripts/docker/10/install-containers-feature.ps1"
],
"type": "powershell"
},
{
"type": "windows-restart"
},
{
"environment_vars": [
"docker_images={{user `docker_images`}}",
"docker_provider={{user `docker_provider`}}",
"docker_version={{user `docker_version`}}"
],
"scripts": [
"./scripts/docker/add-docker-group.ps1",
"./scripts/docker/install-docker.ps1",
"./scripts/docker/docker-pull.ps1",
"./scripts/docker/open-docker-insecure-port.ps1",
"./scripts/docker/open-docker-swarm-ports.ps1",
"./scripts/docker/remove-docker-key-json.ps1",
"./scripts/docker/disable-windows-defender.ps1"
],
"type": "powershell"
},
{
"scripts": [
"./scripts/uac-enable.bat",
"./scripts/set-winrm-automatic.bat",
"./scripts/compact.bat"
],
"type": "windows-shell"
}
],
"post-processors": [
{
"type": "vagrant",
"keep_input_artifact": false,
"output": "windows_10_docker{{.Provider}}.box",
"vagrantfile_template": "vagrantfile-windows_10.template"
}
],
"variables": {
"iso_url": "
https://software-download.microsoft.com/download/pr/17134.1.180410-1804.rs4_release_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso",
"iso_checksum_type": "md5",
"iso_checksum": "89f6b3079b3669560d29f3c4be9cc74d",
"autounattend": "./answer_files/10/Autounattend.xml"
}
}
In which path should I cinlude the script to install visual studio and
the other features?. This is an example of the visual studio script:
$vs2017Url = "
https://aka.ms/vs/15/release/vs_community.exe";
$vs2017Exe = "${env:Temp}\vs_community.exe";
Invoke-WebRequest -Uri $vs2017Url -OutFile $vs2017Exe;
cd ${env:Temp}
.\vs_community.exe --add Microsoft.VisualStudio.Workload.Azure
--includeRecommended --includeOptional --quiet --norestart
And the last question. There is a way to include docker containers in
the build?. I got the follwoing example:
"variables": {
"docker_images": "microsoft/windowsservercore microsoft/nanoserver",
"docker_provider": "ce",
"docker_version": "17.10.0",
"source_path": "path-to.vmx"
}
}
Regards
> To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/fcafcfdd-09c9-4094-bb29-ef9d1b2cd351%40googlegroups.com.