# services.<name>.build

> How the service is built.

How the service is built. Without this block Guv detects a Dockerfile or uses Railpack.

- **Type:** object
- **Since:** manifest v1

## Example

```yaml
services:
  web:
    build:
      builder: dockerfile
      dockerfile: services/api/Dockerfile
```

## Fields

### builder

`services.<name>.build.builder`

`railpack` auto-detects the stack, `dockerfile` builds a Dockerfile, `image` deploys a prebuilt image.

- **Type:** `railpack`, `dockerfile`, `image`
- **Default:** `railpack`
- **Since:** manifest v1

```yaml
services:
  web:
    build:
      builder: dockerfile
```

### dockerfile

`services.<name>.build.dockerfile`

Path to the Dockerfile, relative to the repository root.

- **Type:** string
- **Since:** manifest v1

```yaml
services:
  web:
    build:
      dockerfile: services/api/Dockerfile
```

### context

`services.<name>.build.context`

Build context directory, relative to the repository root. Defaults to `root`.

- **Type:** string
- **Since:** manifest v1

```yaml
services:
  web:
    build:
      context: services/api
```

### image

`services.<name>.build.image`

Image to deploy when `builder` is `image` (Docker Hub, GHCR or a private registry).

- **Type:** string
- **Since:** manifest v1

```yaml
services:
  web:
    build:
      image: ghcr.io/acme/api:1.4.2
```

### registry_credentials

`services.<name>.build.registry_credentials`

Secret holding credentials for a private registry.

- **Type:** string
- **Pattern:** `^secret://[A-Za-z_][A-Za-z0-9_-]{0,127}$`
- **Since:** manifest v1

```yaml
services:
  web:
    build:
      registry_credentials: secret://ghcr-token
```

## See also

- [services](/docs/manifest/services/): all fields of `services`
- [guv.yaml reference](/docs/manifest/)
