Skip to content

feat: add dev container with sibling Postgres#62

Merged
arv merged 7 commits into
mainfrom
arv/devcontainer
Jun 15, 2026
Merged

feat: add dev container with sibling Postgres#62
arv merged 7 commits into
mainfrom
arv/devcontainer

Conversation

@arv

@arv arv commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

Adds a dev container so hello-zero can be developed in a sandbox (VS Code / GitHub Codespaces "Reopen in Container") with no local Node or Postgres setup.

How

The existing docker/docker-compose.yml Postgres runs as a sibling container; the workspace connects to it over the Compose network by service name (zstart_postgres:5432). ZERO_UPSTREAM_DB is preset in the container to override the 127.0.0.1:5430 value from .env (container env beats dotenv).

The workspace has no Docker daemon and no host Docker socket — it cannot create or control containers, which keeps it a meaningful sandbox for development and AI-agent work.

Generated from ghcr.io/rocicorp/devcontainer-templates/sibling-services.

Verified

Booted the full stack: Postgres comes up healthy, seed.sql runs (9 users, 4 mediums), and the workspace reaches the db by service name. No db-up needed inside the container — Postgres is already running as a sibling.

🤖 Generated with Claude Code

Adds a dev container so the app can be developed in a sandbox without a
local Node/Postgres setup. The existing docker/docker-compose.yml Postgres
runs as a sibling container; the workspace connects over the Compose
network by service name.

The workspace has no Docker daemon and no host Docker socket — it cannot
create or control containers. Generated from
ghcr.io/rocicorp/devcontainer-templates/sibling-services.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hello-zero Ready Ready Preview, Comment Jun 15, 2026 11:00am

Request Review

@github-actions github-actions Bot requested a review from cesara June 12, 2026 10:49
@arv arv requested review from grgbkr and removed request for cesara June 12, 2026 10:52
"Dev Containers: Clone Repository in Container Volume" mounts the cloned
repo volume at /workspaces; a ..:/workspaces/hello-zero host bind breaks
that flow on a machine with no host checkout (mounts denied). Rely on the
injected volume instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Bake the Postgres init scripts into the image instead of bind-mounting the
repo's docker/ folder. "Clone Repository in Container Volume" has no host
checkout, so the bind mount of ./ -> /docker-entrypoint-initdb.d from the
repo's docker/docker-compose.yml can't resolve. The override builds
zstart_postgres from .devcontainer/Dockerfile.postgres and uses !override
to drop the init bind, keeping only zstart_pgdata. The repo's canonical
docker/docker-compose.yml is untouched, so normal `docker compose up` users
keep their host bind mount.

Also migrate the agents feature to 2.0.0 and forward GITHUB_TOKEN from the
host so gh authenticates from the token instead of a persisted login.
The previous attempt overrode zstart_postgres in .devcontainer/docker-compose.yml,
but Docker Compose 2.27 (Docker Desktop) rejects redefining a service that
came in via include: with "services.zstart_postgres conflicts with imported
resource". (Newer Compose allows it, which masked the problem in validation.)

Instead, move the seed into the canonical docker/docker-compose.yml: build
zstart_postgres from docker/Dockerfile.postgres, which COPYs seed.sql into
/docker-entrypoint-initdb.d, and drop the ./ bind mount. A bind mount needs a
shared host path, which doesn't exist under "Clone Repository in Container
Volume" (the checkout lives in a Docker named volume). Baking the seed makes
both `pnpm dev:db-up` and the dev container start identically, with no
include-override conflict.
…27 conflict

The devcontainer CLI generates a temporary compose override to wire up the
workspace volume and networking. On Compose 2.27, any service in that
generated override file conflicts with the same service brought in via
include: ("services.zstart_postgres conflicts with imported resource").
Multiple -f files allow the CLI's generated override to freely merge
services; include: does not.

Switch dockerComposeFile to ["../docker/docker-compose.yml",
"docker-compose.yml"] and remove the include: from docker-compose.yml.
Relative paths in docker/docker-compose.yml (build context: .) still
resolve against docker/ because Docker Compose resolves each -f file's
paths relative to that file's own directory.
By default Vite listens on 127.0.0.1, which VS Code can't reach from
outside the container network. server.host: true binds to 0.0.0.0 so
VS Code auto-forwards the port without needing --host on the CLI.
@arv arv merged commit a54fe1e into main Jun 15, 2026
5 checks passed
@arv arv deleted the arv/devcontainer branch June 15, 2026 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants