t3-code-android-nightly/.repos/alchemy-effect/examples/docker-postgres
Julius Marminge e3c85ead63
chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-17 23:21:25 -07:00
..
alchemy.run.ts chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327) 2026-09-17 23:21:25 -07:00
package.json chore(refs): sync Effect and Alchemy references to rc.115 and beta.78 (#12327) 2026-09-17 23:21:25 -07:00
README.md Upgrade Effect and Alchemy betas (#4643) 2026-07-27 16:21:02 +02:00
tsconfig.json Upgrade Effect and Alchemy betas (#4643) 2026-07-27 16:21:02 +02:00

Docker PostgreSQL Example

This example provisions PostgreSQL 18 Alpine with Docker resources:

  • Docker.RemoteImage pulls postgres:18-alpine
  • Docker.Network creates an app network
  • Docker.Volume creates persistent database storage
  • Docker.Container starts PostgreSQL with a redacted password, a network alias, a named volume, and a host port
  • Docker.inspectContainer returns the bound host port

Docker resources use the active Docker CLI context. That can be Docker Desktop, a remote Docker host, an SSH context, or a CI runner daemon.

These resources are separate from Cloudflare.Container. The bridge between Docker and cloud container platforms is an image reference or registry digest, not a swappable container object.

Commands

bun install
POSTGRES_PASSWORD=change-me bun run --filter docker-postgres-example deploy
bun run --filter docker-postgres-example destroy

If POSTGRES_PASSWORD is omitted, the example generates and stores a redacted password with Alchemy.makeRandom.

The stack publishes PostgreSQL on localhost:15432:

psql postgres://alchemy:change-me@localhost:15432/app