Skip to content

fix: render runtime-access.sql into the service-dir build context (#70) - #71

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
issue-70-0-0-126-generated-dockerfile-copys-runtime-access
Aug 23, 2026
Merged

fix: render runtime-access.sql into the service-dir build context (#70)#71
antoinetoussaint-byte merged 1 commit into
mainfrom
issue-70-0-0-126-generated-dockerfile-copys-runtime-access

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

Closes#70.

Summary

  • codefly build service builds with the service directory as the docker context: the CLI (cli@v0.1.139) resolves the recipe's Context: "." to the service dir while resolving the Dockerfile against the recipe output dir. The bootstrap Dockerfile COPYs runtime-access.sql root-relative, but buildRecipe rendered it only into the recipe tree — nothing landed at the service-dir root, so the build failed with COPY runtime-access.sql … "/runtime-access.sql": not found.
  • Render runtime-access.sql into the service dir too, beside the already-committed migrations/, so the COPY the CLI runs resolves — mirroring how migrations/ already lives in both the service dir and the recipe tree. The recipe tree keeps its own copy so the emitted artifact stays a self-contained buildable context.

Test plan

  • go test ./ -run 'TestBuild|Bootstrap|RuntimeAccess' — passes; TestBuildEmitsRecipeToOutputDirectory now asserts runtime-access.sql at the service-dir context root as well as in the recipe tree.
  • go build ./ and go vet ./ — clean.
  • End-to-end (maintainer's harness): codefly agent build --native-only --skip-audit, then codefly build service --local-agents on a postgres service with spec.runtime-read-write-roles — expect COPY runtime-access.sql … DONE and the image to export.

@antoinetoussaint-byte
antoinetoussaint-byteforce-pushed the issue-70-0-0-126-generated-dockerfile-copys-runtime-access branch from 2cc8483 to f7430cdCompareAugust 23, 2026 23:43
The CLI resolves the recipe's "." context to the service directory but
resolves the Dockerfile against the recipe output directory, so
`codefly build service` builds with the service dir as context. buildRecipe
rendered runtime-access.sql only into the recipe tree, so nothing sat at the
service-dir root the Dockerfile COPYs it from and the build failed with
`COPY runtime-access.sql ... "/runtime-access.sql": not found`.
Render it into the service dir too, beside the already-committed migrations/,
so the COPY resolves — mirroring how migrations/ lives in both the service dir
and the recipe tree. Correct the buildRecipe doc comment, which still claimed
"the context is the recipe tree itself" — the exact wrong model behind this
regression and #68.
Because the build now writes a generated runtime-access.sql into the consumer's
service directory on every run, scaffold a .gitignore in the factory so it is
not left as untracked noise beside the committed migrations/. Embed the factory
tree with `all:` so the .gitignore dotfile is carried in (plain go:embed skips
dotfiles and would drop it silently).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antoinetoussaint-byte
antoinetoussaint-byteforce-pushed the issue-70-0-0-126-generated-dockerfile-copys-runtime-access branch from f7430cd to 3f57c0fCompareAugust 23, 2026 23:51
@antoinetoussaint-byte
antoinetoussaint-byte merged commit a865c7a into mainAug 23, 2026
1 check passed
Sign up for freeto 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.

0.0.126: generated Dockerfile COPYs runtime-access.sql from context root, but agent stages it under builder/ in the service-dir build context

1 participant

@antoinetoussaint-byte