Fix Docker build and .env discovery broken by the workspace migration#272
Open
carlosplanchon wants to merge 1 commit into
Open
Fix Docker build and .env discovery broken by the workspace migration#272carlosplanchon wants to merge 1 commit into
carlosplanchon wants to merge 1 commit into
Conversation
…tion
Two quickstart-breaking leftovers from the uv-workspace migration, plus a
test-isolation consequence of the second fix.
Docker build: the generated compose built with ./backend as context while
uv.lock now lives at the workspace root, so `docker compose up --build`
failed on a clean clone ("/uv.lock": not found). The build context is now
the workspace root: the Dockerfile copies the root manifest + lock plus
the member pyprojects and exports with `uv export --package
fastapi-boilerplate` (the local project line is now "./backend", filter
adjusted; dev requirements export the backend's `dev` extra). The compose
templates gain build_context/backend_dockerfile variables, while
host-side paths such as volume mounts keep using backend_context. A root
.dockerignore keeps the context lean and free of secrets (.env excluded).
Verified: dev, prod and migrate targets all build.
.env discovery: the README says `cp backend/.env.example backend/.env`,
but settings searched /app/.env, the workspace root, and /, silently
ignoring the documented location when running outside Docker (everything
fell back to defaults). backend/.env now comes right after /app/.env in
the search list.
Since backend/.env is now reliably discovered, a developer's real .env
would leak into unit tests that assert code defaults, so settings skip
.env loading under pytest: the suite already declares ENVIRONMENT=pytest,
and PYTEST_VERSION covers runs where the pytest-env plugin is absent.
181 unit + 17 auth integration tests green.
Signed-off-by: Carlos Andrés Planchón Prestes <carlosandresplanchonprestes@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two quickstart-breaking leftovers from the uv-workspace migration: (1) the generated compose builds with ./backend as context but uv.lock lives at the workspace root, so docker compose up --build fails on a clean clone; fixed by building from the workspace root with uv export --package (dev/prod/migrate targets verified). (2) settings never look for backend/.env, the location the README tells you to create, so running without Docker silently falls back to defaults; fixed by adding it to the search list, plus skipping .env loading under pytest so a developer's real .env can't leak into the unit tests that assert code defaults.