feat(cli): ship Docker assets with every smpy new scaffold - #252
Merged
Conversation
Every new app now gets a working container story by default instead of only when background_tasks is selected: - docker/host.Dockerfile: uv + Node builder that runs gen-pages before the Vite build (the old optional template skipped it, so the frontend stage could not build any app with module pages), slim non-root runtime, /health healthcheck, `alembic upgrade heads` on start. - docker-compose.yml matched to the --db choice: sqlite scaffolds run the app container alone with the DB on a named volume, postgres scaffolds get a postgres service. Migration histories are dialect-frozen at autogenerate time (sa.false() renders as DEFAULT 0 under SQLite, which Postgres rejects), so containers must run the same dialect the migrations were generated against. - background_tasks adds redis/worker/beat services that reuse the app image with a celery command; the separate worker.Dockerfile is gone. The app service also gets the compose-network broker URLs because BackgroundTasksSettings refuses a localhost broker in production. - smpy new generates real SM_USERS_*_TOKEN_SECRET values into .env.example (like SM_SECRET_KEY) so UsersSettings passes its production-mode boot validation inside containers. - .dockerignore + make docker-up / docker-build / docker-down targets. The BackgroundTasksRecipe slims down to run_worker.py + broker env keys + Make targets; compose/Dockerfile emission moved to the always-run docker_assets step, which knows the whole module selection. Verified end-to-end: built a default scaffold's image and booted the stack — app container healthy, /health 200, landing page 200. Claude-Session: https://claude.ai/code/session_016YtWRT8AVeG84jf7uNMv2s
antosubash
marked this pull request as ready for review
August 7, 2026 21:00
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.
Every
smpy newapp now gets a working container story by default — previously Docker files only appeared whenbackground_taskswas selected, and even those couldn't build a real app.What's included in every scaffold
docker/host.Dockerfile— uv + Node builder stage that runsgen-pagesbefore the Vite build (the old optional template skipped it, so the frontend stage failed on the missingmodules.generated.{ts,css}), slim non-root runtime,/healthhealthcheck,alembic upgrade headson container start.docker-compose.ymlmatched to the--dbchoice — sqlite scaffolds run the app container alone with the DB on a named volume;--db postgresscaffolds get apostgresservice. Migration histories are dialect-frozen at autogenerate time (sa.false()renders asDEFAULT 0under SQLite, which Postgres rejects), so containers must run the dialect the migrations were generated against — discovered by actually booting a scaffold against Postgres.background_tasksaddsredis/worker/beatservices reusing the app image with a celery command (separateworker.Dockerfiledeleted). The app service also gets the compose-network broker URLs, sinceBackgroundTasksSettingsrefuses a localhost broker in production.SM_USERS_*_TOKEN_SECRETs in.env.example(likeSM_SECRET_KEY) soUsersSettingspasses production boot validation in containers..dockerignoreandmake docker-up/docker-build/docker-downtargets.The
BackgroundTasksRecipeslims down torun_worker.py+ broker env keys + Make targets; compose/Dockerfile emission moved to an always-rundocker_assets.pystep that knows the whole module selection.Verification
make lintgreen (12 new tests intest_cli_docker_assets.py)./health200, landing page 200.docker compose configvalidates all four compose shapes (sqlite/postgres × plain/tasks).Design doc:
docs/superpowers/specs/2026-08-06-default-docker-scaffold-design.mdhttps://claude.ai/code/session_016YtWRT8AVeG84jf7uNMv2s