Speed up local OSCAR image builds and add explicit no-cache rebuild support#504
Open
Speed up local OSCAR image builds and add explicit no-cache rebuild support#504
Conversation
Optimizes the local make deploy workflow in oscar by enabling BuildKit by default, caching Go modules and build artifacts, avoiding duplicate npm installs, and shrinking the Docker build context via .dockerignore. It also adds NO_CACHE=1 support in the Makefile to explicitly force docker build --no-cache when needed.
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.
Summary
This PR speeds up the local OSCAR image build and deploy workflow without changing deployment semantics.
It improves Docker layer reuse for both the Go backend and the dashboard build, reduces the Docker build context to only the files needed for the runtime image, and adds explicit support for forcing a clean rebuild when needed.
Changes
Makefilenpm installwork in the dashboard image build.dockerignoreNO_CACHE=1support to map todocker build --no-cacheWhy
Local
make deployiterations were slower than necessary because the image build repeatedly redownloaded dependencies, rebuilt layers that could be cached, and sent a much larger build context than required.Validation
docker build -t localhost:5001/oscar:feat-speed-build-test .docker buildreuses cached layers successfullymake build IMAGE_TAG=feat-speed-build-make-test BUILD_CONTEXT=.make -n build BUILD_CONTEXT=. IMAGE_TAG=dry-run-testmake -n build BUILD_CONTEXT=. IMAGE_TAG=dry-run-test NO_CACHE=1Impact
The default local workflow stays the same:
make deploy KUBE_CONTEXT=kind-oscar-test-mtyBut rebuilds are significantly faster after the first successful build, and clean rebuilds remain available via:
make deploy KUBE_CONTEXT=kind-oscar-test-mty NO_CACHE=1