Skip to content

Add --no-cache flag for deployments#93

Open
emanuelefaja wants to merge 1 commit intoletsdiscodev:mainfrom
emanuelefaja:feature/no-cache-deploy
Open

Add --no-cache flag for deployments#93
emanuelefaja wants to merge 1 commit intoletsdiscodev:mainfrom
emanuelefaja:feature/no-cache-deploy

Conversation

@emanuelefaja
Copy link
Copy Markdown

@emanuelefaja emanuelefaja commented Mar 25, 2026

Summary

  • Adds noCache field to the deployment POST request body
  • Persists the flag on the Deployment model (new no_cache boolean column)
  • Threads the flag through DeploymentInfobuild_images()docker.build_image()
  • Passes --no-cache to docker build when the flag is set
  • Includes Alembic migration for the new column

Motivation

When debugging build issues or dealing with stale cached layers, there's no way to force a clean Docker build through Disco. The only workaround is SSH-ing into the server and running docker builder prune, which affects all projects.

This adds per-deployment cache control via disco deploy --project <name> --no-cache.

Companion PR

CLI side: letsdiscodev/cli#116

Files changed

File Change
disco/models/deployment.py Add no_cache boolean column
disco/endpoints/deployments.py Accept noCache in request body, pass to create_deployment()
disco/utils/deployments.py Thread no_cache param through create_deployment()
disco/utils/deploymentflow.py Add to DeploymentInfo dataclass, pass to both build_image() call sites
disco/utils/docker.py Add no_cache param, insert --no-cache into docker build args
disco/alembic/versions/a1b2c3d4e5f6_add_no_cache.py Migration to add column

Test plan

  • Deploy with noCache: false (default) — should behave identically to current behavior
  • Deploy with noCache: true — docker build output should show layers being rebuilt (no CACHED lines)
  • Verify migration runs cleanly on existing database
  • Verify existing deployments default to no_cache = false

Allow users to trigger Docker builds without cache via the deploy API.
Adds `noCache` field to the deployment request body, persists it on the
Deployment model, and passes `--no-cache` to `docker build` when set.

Includes Alembic migration to add the `no_cache` column.
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