# pier deploy

> Build and roll changed apps and sites (implies apply)

URL: https://pier.run/docs/cli/reference/deploy

```bash
pier deploy [<ref>] [flags]
```

Build and roll changed apps and sites (implies apply).

## Arguments

| Argument | Required | Description                                                                    |
| -------- | -------- | ------------------------------------------------------------------------------ |
| `<ref>`  | no       | Deploy one app or site only (name or name/target); default: everything changed |

## Flags

| Flag               | Value              | Default  | Description                                                                                                         |
| ------------------ | ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `-y`, `--yes`      |                    |          | Skip confirmation prompt                                                                                            |
| `-f`, `--force`    |                    |          | Force rebuild all apps                                                                                              |
| `--tag`            |                    | `latest` | Image tag                                                                                                           |
| `--no-resume`      |                    |          | Refuse to resume suspended targets — fail fast (CI escape hatch)                                                    |
| `--prune-external` |                    |          | Also delete resources on the server that aren't in pier.yaml and were never applied from it (added via console/API) |
| `--purge`          |                    |          | Deletes in this deploy skip the 30-day recovery window (torn down immediately)                                      |
| `--rename`         | `KIND.OLD=NEW,...` |          | Apply a rename in place instead of delete+create (KIND.OLD=NEW, e.g. apps.api=gateway). Repeatable.                 |
| `--path`           | `STRING`           |          | Site only: directory to build and upload (default: the site's build context)                                        |
| `--build-cmd`      | `STRING`           |          | Site only: override the build command (build-time only)                                                             |
| `--output-dir`     | `STRING`           |          | Site only: override the output directory (build-time only)                                                          |
| `--skip-build`     |                    |          | Site only: skip install and build, upload the directory as is                                                       |

[Global flags](/docs/cli/reference#global-flags) apply to every command.

## Examples

```bash
pier deploy                 # everything changed in the current environment
pier deploy api/stage       # one target
pier deploy -e prod -y      # non-interactive, explicit environment
pier deploy www --path ./dist --skip-build
```

## Behaviour

* `deploy` runs `apply` first. A change that only touches config (variables, plan) is
  applied and does not roll the workload; a change to the image, build context or a
  linked secret does.
* A paused target is resumed before it is rolled unless `--no-resume` is set.
* `--purge` and `--prune-external` delete; both are refused without `-y` when there is
  no terminal.

## See also

[`pier apply`](/docs/cli/reference/apply) · [`pier deploys`](/docs/cli/reference/deploys) ·
[`pier rollback`](/docs/cli/reference/rollback) · [Concepts: apply, deploy, staged](/docs/concepts#apply-deploy-staged)
