# Compose baseline

Three docker-compose files + two Dockerfiles. Postgres included.
Two flavours: dev with volume-mounted HMR, prod with built images.

## Layout

```
.
├── docker/
│   ├── api.Dockerfile        # multi-stage: deps + builder + prod
│   ├── web.Dockerfile        # multi-stage: deps + builder + prod
│   └── .dockerignore
├── docker-compose.yml        # postgres only — the "infra" file
├── docker-compose.dev.yml    # postgres + apps in dev mode
└── docker-compose.prod.yml   # postgres + apps in prod (built images)
```

## Common flows

### Daily dev — fastest

```sh
pnpm db:up      # boot postgres only
pnpm dev        # pnpm -r --parallel dev, native node, HMR <50ms
```

### Daily dev — full-docker (slower HMR but zero host install)

```sh
pnpm dev:docker        # boots postgres + all apps in containers
pnpm dev:docker:down   # stop everything
```

### Production smoke-test on localhost

```sh
pnpm prod:build      # build all images (slow first run, ~5 min)
pnpm prod:up         # boot the prod stack
pnpm prod:down       # tear down
```

## When to add apps

The shipped compose files cover ONE api + ONE web by default. As you
add apps to `apps/`, mirror the pattern in both `docker-compose.dev.yml`
and `docker-compose.prod.yml`: copy a service block, change its
`working_dir` / `APP_PATH` / port.

A future `voltro baseline sync` will auto-regenerate the service
blocks from your `project.json` / `app.config.ts` files. Until then,
hand-edit.

## What's NOT in here

- No CI configs (GitHub Actions / GitLab CI). Each provider's syntax
  is different; we don't pick a winner.
- No reverse proxy (Traefik / nginx / Caddy). If you need one in
  prod, add it as a service in `docker-compose.prod.yml`.
- No Redis, S3-emulator, or other infra. Add as needed.

## Switching baselines

`voltro baseline set helm` → swaps to Helm chart + Kustomize overlays.
`voltro baseline set bare` → removes docker-compose entirely.

Either switch backs up the current docker-compose files + Dockerfiles
to `.voltro-baseline-backup/<timestamp>/`. Application code is never
touched.
