gws rebuild
Rebuild and redeploy one service in the active deployment, leaving every other service running. The watch orchestrator calls this automatically when it detects a Dockerfile or source change that requires a fresh image; you can call it directly when you want to force a rebuild without going through gws down && gws up.
Uses GetWebstack's embedded Kubernetes client (no kubectl) and the bundled image-build manager (k3d / minikube / docker depending on the cluster).
Usage
gws rebuild <service> [options]
| Argument | Description |
|---|---|
service | Name of the service in gws.json to rebuild. |
| Flag | Description |
|---|---|
-w, --worktree <name> | Worktree to target (defaults to active worktree). |
Auth: requires an active deployment for the target project / worktree — gws up must have been run for it. gws rebuild rolls a new image into an existing Deployment; it does not create one. If -w points at a worktree that isn't currently deployed, the command will fail with No active deployment with deployment ID found.
Behaviour
- Resolves the project + worktree.
- Loads the deployment record to find the cluster (
kubeconfigPath,kubeContext,registryPort). - Looks up the service in
gws.json— fails if the name doesn't exist. - Picks an
ImageBuildManagerstrategy based on cluster type and registry mode. - Builds the new image and pushes it to the cluster's registry.
- Patches the existing Deployment to roll the new image without touching anything else.
If you've changed gws.json itself (added a new service, changed dependencies, …), use gws config import + gws up instead — gws rebuild only rolls a single service's image.
Examples
# Rebuild the api service
gws rebuild api
# Rebuild on a worktree
gws rebuild api -w feature-payments
# Force a rebuild after a manual code edit, without changing gws.json
gws rebuild worker
See also
gws up— full re-deploy whengws.jsonchangedgws apply— apply ad-hoc manifests- Watch configurations — what triggers an auto-rebuild