# Build and deploy Windows IIS workloads

This page explains how to build and deploy your Windows application containers
using Skaffold.

> [!NOTE]
> **Note:** Using Skaffold is the recommended approach, but is not required. You can also build directly with [Docker `build`](https://docs.docker.com/build/) and apply the changes with [`kubectl`](https://kubernetes.io/docs/reference/kubectl/).

Skaffold handles the workflow for building, pushing and deploying your
application. The Skaffold configuration `skaffold.yaml` is at the root
folder of the generated artifacts. To learn how to edit the `skaffold.yaml`
file, see the
[Skaffold file reference](https://skaffold.dev/docs/references/yaml/).

> [!CAUTION]
> **Caution** : Skaffold
> [will be removed](https://groups.google.com/g/skaffold-users/c/FTR3xLJpePY)
> from gcloud CLI releases after January 15, 2027. Going forward, Skaffold can be installed
> following the instructions in the
> [Installing Skaffold documentation](https://skaffold.dev/docs/install/).
>
> <br />
>
> On January 29, 2027 the Skaffold GitHub repository will be archived. All
> existing releases will remain available to users.

## Before you begin

This document assumes that you've completed the migration and reviewed the
generated migration artifacts.

## Build the container image

The configuration generated by Migrate to Containers CLI lets
you build single-arch images on a Windows machine, as well as
[multi-arch images using Cloud Build](https://docs.cloud.google.com/kubernetes-engine/docs/tutorials/building-windows-multi-arch-images.md.txt)
on a Linux machine.

If you use Cloud Shell, Skaffold is already installed. If you need to install
Skaffold, see [Installing Skaffold](https://skaffold.dev/docs/install/).

### Build a single-arch image on a Windows machine

On a Windows machine, build a single-arch container image using Skaffold:

```bash
skaffold build -d REPOSITORY_PATH --cache-artifacts=false
```

Replace <var translate="no">REPOSITORY_PATH</var> with the path to your artifact repository.
For example,
`us-central1-docker.pkg.dev/PROJECT_ID/REPOSITORY_NAME`.

If you want to build and deploy the container image in the same step, then you
can replace the `build` command with the `run` command.

### Build a multi-arch image on a Linux machine

Set the following environment variables:

- Mandatory
  - `CLOUDBUILD_PROJECT`: the project where you want Cloud Build to run
  - `REGION`: the region in which Cloud Build will run
  - `ZONE`: the zone in which Cloud Build will run
- Optional - If the network and subnetwork are not specified, the default VPC and default subnetwork are used.
  - `NETWORK`: the network in which the Windows builder VMs will be created (VPC name)
  - `SUBNETWORK`: the subnetwork in which the Windows builders will be created

Follow the instructions in [Building multi-arch images](https://docs.cloud.google.com/kubernetes-engine/docs/tutorials/building-windows-multi-arch-images.md.txt#building_multi-arch_images_using_the_gke-windows-builder).

If you want to use custom worker pools for Cloud Build (to avoid firewall
rules creation for example), set the following environment variables:

- Mandatory
  - `WORKERPOOL`: the name of the workerpool
  - `WORKERPOOL_REGION`: the region of the workerpool
- Optional
  - `USE_INTERNAL_IP`: true if the workerpool is connected with a shared VPC to `NETWORK`

The following are the commands to run a Windows build:

```bash
export CLOUDBUILD_PROJECT=CLOUDBUILD_PROJECT
export REGION=REGION
export ZONE=ZONE

skaffold build -d REPOSITORY_PATH
```

Replace <var translate="no">REPOSITORY_PATH</var> with the path to your artifact repository.
For example,
`us-central1-docker.pkg.dev/PROJECT_ID/REPOSITORY_NAME`.

If you want to build and deploy the container image in the same step, then you
can replace the `build` command with the `run` command.

## Deploy the container image

After the container image is built, use Skaffold to deploy it:

```bash
skaffold run -d REPOSITORY_PATH
```

Replace <var translate="no">REPOSITORY_PATH</var> with the path to your artifact repository.
For example,
`us-central1-docker.pkg.dev/PROJECT_ID/REPOSITORY_NAME`.

## What's next

- Learn how to [monitor migrated workloads](https://docs.cloud.google.com/migrate/containers/docs/monitoring-migrated-workloads.md.txt).
- Learn how to troubleshoot the issue [Skaffold build for Windows images fails](https://docs.cloud.google.com/migrate/containers/docs/troubleshooting/issues-with-windows-iis.md.txt#skaffold_build_for_windows_images_fails).