forked from joefitzgerald/packer-windows
-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from cicerops/windows-2022-docker
Add resources for building Windows Server 2022 with Docker
- Loading branch information
Showing
6 changed files
with
285 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
if (Test-Path ./output-hyperv-iso) { | ||
Remove-Item -Recurse -Force ./output-hyperv-iso | ||
} | ||
|
||
packer build --only=hyperv-iso ` | ||
--var iso_url=./iso/20348.169.210806-2348.fe_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso ` | ||
--var iso_checksum="sha256:4f1457c4fe14ce48c9b2324924f33ca4f0470475e6da851b39ccbf98f44e7852" ` | ||
windows_2022_docker.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
# Insider ISO | ||
packer build \ | ||
--only=vmware-iso \ | ||
--var vhv_enable=true \ | ||
--var autounattend=./tmp/2022_core/Autounattend.xml \ | ||
--var iso_url=~/.cache/packer/caff720c675a0670657cb6bcfb438d3b0c664081.iso \ | ||
--var iso_checksum="sha256:4f1457c4fe14ce48c9b2324924f33ca4f0470475e6da851b39ccbf98f44e7852" \ | ||
windows_2022_docker.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"accelerator": "kvm", | ||
"boot_wait": "0s", | ||
"communicator": "winrm", | ||
"cpus": 2, | ||
"disk_size": "{{user `disk_size`}}", | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./scripts/disable-screensaver.ps1", | ||
"./scripts/disable-winrm.ps1", | ||
"./scripts/docker/enable-winrm.ps1", | ||
"./scripts/docker/2016/install-containers-feature.ps1", | ||
"./scripts/microsoft-updates.bat", | ||
"./scripts/win-updates.ps1" | ||
], | ||
"headless": true, | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_url": "{{user `iso_url`}}", | ||
"memory": "{{user `memory`}}", | ||
"output_directory": "windows_2022_docker-qemu", | ||
"qemuargs": [ | ||
[ | ||
"-drive", | ||
"file=windows_2022_docker-qemu/{{ .Name }},if=virtio,cache=writeback,discard=ignore,format=qcow2,index=1" | ||
], | ||
[ | ||
"-drive", | ||
"file={{ user `virtio_win_iso` }},media=cdrom,index=3" | ||
] | ||
], | ||
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", | ||
"type": "qemu", | ||
"vm_name": "WindowsServer2022Docker", | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
}, | ||
{ | ||
"boot_wait": "0s", | ||
"communicator": "winrm", | ||
"configuration_version": "8.0", | ||
"cpus": 2, | ||
"disk_size": "{{user `disk_size`}}", | ||
"enable_secure_boot": true, | ||
"enable_virtualization_extensions": true, | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./scripts/disable-screensaver.ps1", | ||
"./scripts/disable-winrm.ps1", | ||
"./scripts/docker/enable-winrm.ps1", | ||
"./scripts/docker/2016/install-containers-feature.ps1", | ||
"./scripts/microsoft-updates.bat", | ||
"./scripts/win-updates.ps1" | ||
], | ||
"guest_additions_mode": "disable", | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_url": "{{user `iso_url`}}", | ||
"memory": "{{user `memory`}}", | ||
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", | ||
"switch_name": "{{user `hyperv_switchname`}}", | ||
"type": "hyperv-iso", | ||
"vm_name": "WindowsServer2022Docker", | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
}, | ||
{ | ||
"boot_wait": "2m", | ||
"communicator": "winrm", | ||
"cpus": 2, | ||
"disk_adapter_type": "lsisas1068", | ||
"disk_size": "{{user `disk_size`}}", | ||
"disk_type_id": "{{user `disk_type_id`}}", | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./scripts/disable-screensaver.ps1", | ||
"./scripts/disable-winrm.ps1", | ||
"./scripts/docker/enable-winrm.ps1", | ||
"./scripts/docker/2016/install-containers-feature.ps1", | ||
"./scripts/microsoft-updates.bat", | ||
"./scripts/win-updates.ps1" | ||
], | ||
"guest_os_type": "windows9srv-64", | ||
"headless": "{{user `headless`}}", | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_url": "{{user `iso_url`}}", | ||
"memory": "{{user `memory`}}", | ||
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", | ||
"type": "vmware-iso", | ||
"version": 14, | ||
"vm_name": "WindowsServer2022Docker", | ||
"vmx_data": { | ||
"RemoteDisplay.vnc.enabled": "false", | ||
"RemoteDisplay.vnc.port": "5900", | ||
"vhv.enable": "{{user `vhv_enable`}}" | ||
}, | ||
"vmx_remove_ethernet_interfaces": true, | ||
"vnc_port_max": 5980, | ||
"vnc_port_min": 5900, | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
}, | ||
{ | ||
"boot_wait": "2m", | ||
"communicator": "winrm", | ||
"cpus": 2, | ||
"disk_size": "{{user `disk_size`}}", | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./scripts/disable-screensaver.ps1", | ||
"./scripts/disable-winrm.ps1", | ||
"./scripts/docker/enable-winrm.ps1", | ||
"./scripts/docker/2016/install-containers-feature.ps1", | ||
"./scripts/microsoft-updates.bat", | ||
"./scripts/win-updates.ps1" | ||
], | ||
"guest_os_type": "win-2022", | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_url": "{{user `iso_url`}}", | ||
"memory": "{{user `memory`}}", | ||
"parallels_tools_flavor": "win", | ||
"parallels_tools_mode": "disable", | ||
"prlctl": [ | ||
[ | ||
"set", | ||
"{{.Name}}", | ||
"--adaptive-hypervisor", | ||
"on" | ||
], | ||
[ | ||
"set", | ||
"{{.Name}}", | ||
"--efi-boot", | ||
"off" | ||
] | ||
], | ||
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", | ||
"type": "parallels-iso", | ||
"vm_name": "WindowsServer2022Docker", | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
}, | ||
{ | ||
"boot_wait": "2m", | ||
"communicator": "winrm", | ||
"cpus": 2, | ||
"disk_size": "{{user `disk_size`}}", | ||
"floppy_files": [ | ||
"{{user `autounattend`}}", | ||
"./scripts/disable-screensaver.ps1", | ||
"./scripts/disable-winrm.ps1", | ||
"./scripts/docker/enable-winrm.ps1", | ||
"./scripts/docker/2016/install-containers-feature.ps1", | ||
"./scripts/microsoft-updates.bat", | ||
"./scripts/win-updates.ps1" | ||
], | ||
"guest_additions_mode": "disable", | ||
"guest_os_type": "Windows2016_64", | ||
"headless": "{{user `headless`}}", | ||
"iso_checksum": "{{user `iso_checksum`}}", | ||
"iso_url": "{{user `iso_url`}}", | ||
"memory": "{{user `memory`}}", | ||
"post_shutdown_delay": "10s", | ||
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", | ||
"type": "virtualbox-iso", | ||
"vm_name": "WindowsServer2022Docker", | ||
"winrm_password": "vagrant", | ||
"winrm_timeout": "{{user `winrm_timeout`}}", | ||
"winrm_username": "vagrant" | ||
} | ||
], | ||
"post-processors": [ | ||
{ | ||
"keep_input_artifact": false, | ||
"output": "windows_2022_docker_{{.Provider}}.box", | ||
"type": "vagrant", | ||
"vagrantfile_template": "vagrantfile-windows_2016.template" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"execute_command": "{{ .Vars }} cmd /c \"{{ .Path }}\"", | ||
"scripts": [ | ||
"./scripts/enable-rdp.bat" | ||
], | ||
"type": "windows-shell" | ||
}, | ||
{ | ||
"scripts": [ | ||
"./scripts/vm-guest-tools.ps1", | ||
"./scripts/debloat-windows.ps1", | ||
"./scripts/docker/set-winrm-automatic.ps1" | ||
], | ||
"type": "powershell" | ||
}, | ||
{ | ||
"restart_timeout": "{{user `restart_timeout`}}", | ||
"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/wait-for-tiworker.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/set-winrm-automatic.bat", | ||
"./scripts/uac-enable.bat", | ||
"./scripts/compile-dotnet-assemblies.bat", | ||
"./scripts/dis-updates.bat", | ||
"./scripts/compact.bat" | ||
], | ||
"type": "windows-shell" | ||
} | ||
], | ||
"variables": { | ||
"autounattend": "./answer_files/2022_core/Autounattend.xml", | ||
"disk_size": "81920", | ||
"disk_type_id": "1", | ||
"memory": "2048", | ||
"docker_images": "mcr.microsoft.com/windows/nanoserver:ltsc2022 mcr.microsoft.com/windows/servercore:ltsc2022", | ||
"docker_provider": "ce", | ||
"docker_version": "20.10.17", | ||
"headless": "false", | ||
"iso_checksum": "sha256:4f1457c4fe14ce48c9b2324924f33ca4f0470475e6da851b39ccbf98f44e7852", | ||
"iso_url": "https://software-download.microsoft.com/download/sg/20348.169.210806-2348.fe_release_svc_refresh_SERVER_EVAL_x64FRE_en-us.iso", | ||
"manually_download_iso_from": "https://www.microsoft.com/en-us/evalcenter/evaluate-windows-server-2022", | ||
"restart_timeout": "5m", | ||
"vhv_enable": "false", | ||
"winrm_timeout": "6h" | ||
} | ||
} | ||
|