setup-devcontainer
Setup Devcontainer
Give this repo a development container that satisfies two wishes that normally fight:
- Clean host: no toolchain installed on the machine (compiler, runtime, generators, database clients, linters).
- Zero relogin: git, the agent CLIs and any tracker CLI work inside the container under the identity that already exists on the host.
The naive route: a standalone devcontainer image with a postCreateCommand that installs everything: fails both: it re-authenticates on every recreate and can't reach the project's services.
The structuring decision: the devcontainer is a service of the project's Compose stack, not a standalone image. It is called workspace, sits behind a profile so a normal docker compose up doesn't start it, and .devcontainer/devcontainer.json points at the Compose files and names it. Being in the Compose network is what lets it reach postgres:5432 and gateway:8080 by name, from inside a standalone devcontainer, localhost is not the localhost where Compose published the ports, and that discovery costs an afternoon.
Read REFERENCE.md before drafting anything. It holds the two mount mechanics, the failure table that forces them, the full mount map, and the anti-patterns. This file is the process; that file is the reasoning you need to adapt it.
Run this before the rest of the project. Retrofitted later, the toolchain has already been installed on the host "just this once".