Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "starter",
"dockerComposeFile": "docker-compose.yml",
"service": "workspace",
"workspaceFolder": "/workspace",

"forwardPorts": [5173, 4983],
"portsAttributes": {
"5173": { "label": "Vite dev", "onAutoForward": "notify" },
"4983": { "label": "Drizzle Studio", "onAutoForward": "silent" }
},

"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},

"postCreateCommand": ".devcontainer/post-create.sh",
"postStartCommand": "docker compose -f /workspace/docker-compose.yml up -d --wait",

"remoteUser": "node"
}
17 changes: 17 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:
workspace:
image: mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm
command: sleep infinity
privileged: true
environment:
TESTCONTAINERS_RYUK_DISABLED: 'true'
volumes:
- ..:/workspace:cached
- node-modules:/workspace/node_modules
- pnpm-store:/home/node/.local/share/pnpm/store
- dind-storage:/var/lib/docker

volumes:
node-modules:
pnpm-store:
dind-storage:
14 changes: 14 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail

corepack enable
corepack prepare pnpm@10.32.1 --activate

pnpm config set store-dir /home/node/.local/share/pnpm/store

pnpm install

pnpm exec playwright install --with-deps

docker version >/dev/null
docker compose -f /workspace/docker-compose.yml up -d --wait
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ This README is both **descriptive** (what the repo enforces today) and **prescri

## Getting started

This repo is developed exclusively inside a dev container. The container owns the inner loop — Postgres, the Vite dev server, Vitest, Playwright browsers, and the testcontainers daemon all run inside it, so two workspaces side-by-side never collide on host ports or share state. Local `pnpm install` / `pnpm dev` on the host is unsupported.

Open the workspace and **Reopen in Container** (VS Code / Cursor with the Dev Containers extension), or:

```sh
pnpm install
pnpm dev
devcontainer up --workspace-folder .
devcontainer exec --workspace-folder . pnpm dev
```

The first build runs `.devcontainer/post-create.sh`, which installs pnpm deps and Playwright browsers into per-workspace named volumes, then runs `docker compose up -d --wait` against the root `docker-compose.yml` on the container's nested docker daemon. Postgres (and any future app services) are reachable inside the container at `localhost:5432` and are not published to the real host.

Run the test suites:

```sh
Expand Down
Loading