Is there a better development workflow than rebuilding and redeploying my app after every change?
Asked by
MellowPine47
I'm new to deployment and currently stuck in a slow feedback loop. Whenever I change my Compose or Dockerfile configuration to fix an error, I push the changes, wait around 10 minutes for an image to build in a remote CI system, then manually pull and run that image on my server. Often the result is another error, so I repeat the whole process. Is this a normal workflow, or should I be testing changes locally in a way that avoids rebuilding and redeploying the image every time?
Answers
That workflow is much slower than it needs to be, especially during development. Set up a local environment where your source code is mounted into a runtime container, so code changes can be tested without rebuilding and pushing an image each time. Rebuild only when dependencies or the image configuration change. Also check whether your builds are using Docker layer caching, and keep development builds local whenever possible. Timing each step can help identify the biggest bottleneck. Once the application works locally, use the remote build and deployment process for releases rather than every experiment.
Reply to this answer
You may also want to investigate a deployment tool that automates pulling and running updated images. It wonโt replace a good local development setup, but it can reduce the amount of manual work involved when you actually deploy.
Reply to this answer
Add your answer
Answers are reviewed before publication.
MellowPine47: That makes sense. I hadnโt considered that building remotely for every small change was mostly wasting time. Iโll look into local development containers, volume mounts, and build caching.