Skip to main content

When to use Rebuild & Deploy

  • Dockerfile changes – When you’ve updated the Dockerfile or build context.
  • Dependencies update – If you changed package.json, requirements.txt, or other dependency files.
  • Build configuration changes – Updating context, dockerfilePath, or autoBuild in DCDeploy.yml.
  • Corrupted image fixes – Forcing a clean rebuild ensures the latest state is deployed.

How Rebuild & Deploy Works

  1. Fresh Build
    • DCDeploy ignores cached layers.
    • A new Docker image is built from your repository or build context.
  2. Deploy Rollout
    • The new image is deployed to your service.
    • If zero downtime deployment is enabled, old containers are kept alive until the new ones pass health checks.

Rebuild & Deploy via Dashboard

  1. Open the DCDeploy dashboard.
  2. Navigate to your service.
  3. Click Rebuild & Deploy.
  4. Confirm the rebuild trigger.
  5. Watch build and deployment logs in real-time.

Auto Rebuild on Commit

If you set autoBuild: true in your DCDeploy.yml, DCDeploy automatically triggers a Rebuild & Deploy whenever you push new commits to the specified branch. Example:
services:
  my-app:
    build:
      context: ./
      dockerfilePath: ./Dockerfile
      repo: my-org/my-repo
      ref: main
      refType: branch
      autoBuild: true
  • Every commit to main will rebuild and deploy the service automatically.
  • Ensures your production always runs the latest code.
  • Works with both public and private repositories.

Key Difference: Redeploy vs Rebuild & Deploy

FeatureRedeployRebuild & Deploy
Uses cached image?YesNo (fresh build)
SpeedFasterSlower (full build)
Use caseCode/config changes onlyDockerfile/dependencies/build changes

Best Practices

  • Use Redeploy for small code/config changes.
  • Use Rebuild & Deploy when build environment changes are required.
  • Test in staging before running on production.
  • Enable zero downtime to avoid interruptions during rebuilds.
  • Prefer autoBuild: true for continuous integration workflows.
By using Rebuild & Deploy, you ensure your service always runs on the freshest possible build, eliminating risks from outdated or cached images.