Skip to content

fix(cloudflare): support remote images and external Dockerfiles in LocalContainerProvider#790

Merged
john-royal merged 8 commits into
mainfrom
john/local-container-remote-image
Jul 13, 2026
Merged

fix(cloudflare): support remote images and external Dockerfiles in LocalContainerProvider#790
john-royal merged 8 commits into
mainfrom
john/local-container-remote-image

Conversation

@john-royal

@john-royal john-royal commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

LocalContainerProvider only handled the Effect-native main variant, so a container declared with a remote image (or an external context/dockerfile) died under alchemy dev with "Container requires a main entrypoint". The live ContainerProvider supports all three image variants; the local provider now mirrors it:

// main        → bundle + build context (unchanged)
// image       → dev: { imageUri } — the local runtime `docker pull`s it
// dockerfile  → dev: { context, dockerfile } — built against the user's context

Each variant also produces a content hash (sha256Object of the image URI, or directory hash + Dockerfile content) so change detection works the same as the main path.

Shared env handling

Replaced foldEnvIntoEnvironmentVariables with makeContainerEnv, shared by both providers. It returns a plain Record<string, string | Redacted> (merging env + environmentVariables + the injected ALCHEMY_CLOUDFLARE_ACCOUNT_ID) that each provider maps into its own environmentVariables shape.

The local provider keeps its per-run image cache env-free: the cache is warmed by precreate (unresolved props, so binding-derived env values are still Outputs and get skipped). makeAttributes attaches the freshly-computed env instead, so a container isn't started with an incomplete env frozen at precreate time.

Relative dev paths

dev.context / dev.dockerfile are now emitted as paths relative to process.cwd() (and dockerfile relative to context) in both providers, and diff compares the resolved dev object (deepEqual) so a changed build context or Dockerfile triggers an update.

Tests

  • Container.test.ts is now parametrized over dev: true (local, test-local stage) and dev: false (live, test-live stage) via describe.concurrent.each, so every image variant is exercised against both runtimes. A fresh Test.make context is created per case because the local runner stops once the root scope closes.

…calContainerProvider

Co-authored-by: Cursor <cursoragent@cursor.com>
@alchemy-version-bot

alchemy-version-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Install the packages built from this commit:

alchemy

bun add alchemy@https://pkg.ing/alchemy/0e969b2

@alchemy.run/better-auth

bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/0e969b2

@alchemy.run/pr-package

bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/0e969b2

@john-royal john-royal merged commit c999680 into main Jul 13, 2026
8 checks passed
@john-royal john-royal deleted the john/local-container-remote-image branch July 13, 2026 16:07
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.

1 participant