# `Stevedore.Deploy`
[🔗](https://github.com/oshlabs/stevedore/blob/v0.2.0/lib/stevedore/deploy.ex#L1)

Turn an image into a **static, read-only registry** a dumb web server can serve.

`tree/3` copies a source into a `Stevedore.Transport.Static` directory layout
(`v2/<name>/manifests|blobs/...`) and returns the per-manifest response headers a pull client
needs but a static server can't infer — `Content-Type` and `Docker-Content-Digest`.
`nginx_config/2` and `caddy_config/2` emit a server config that serves the tree at `/v2/...`
with those headers (plus `Docker-Distribution-Api-Version`).

Spec: [Docker Registry HTTP API v2](https://distribution.github.io/distribution/spec/api/) —
the headers a pull client requires.

# `headers`

```elixir
@type headers() :: %{optional(String.t()) =&gt; %{required(String.t()) =&gt; String.t()}}
```

Per-request-path headers a static server must add for manifests.

# `caddy_config`

```elixir
@spec caddy_config(
  Path.t(),
  keyword()
) :: {:ok, String.t()}
```

Generates a Caddy config serving the tree at `out` as a read-only `/v2` registry.

# `nginx_config`

```elixir
@spec nginx_config(
  Path.t(),
  keyword()
) :: {:ok, String.t()}
```

Generates an nginx config serving the tree at `out` as a read-only `/v2` registry.

# `tree`

```elixir
@spec tree(String.t(), Path.t(), keyword()) :: {:ok, headers()} | {:error, term()}
```

Copies `source` into a static registry tree at `out` and returns the manifest header map.

`opts`: `:name` (repository; derived from a registry source otherwise), and any `Stevedore.copy/3`
option (`:all`, `:platform`, `:scheme`, `:creds`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
