Skip to content

Speed up local OSCAR image builds and add explicit no-cache rebuild support#504

Open
gmolto wants to merge 1 commit intodevelfrom
feat-speed-build
Open

Speed up local OSCAR image builds and add explicit no-cache rebuild support#504
gmolto wants to merge 1 commit intodevelfrom
feat-speed-build

Conversation

@gmolto
Copy link
Copy Markdown
Member

@gmolto gmolto commented Apr 6, 2026

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

  • enable Docker BuildKit by default from the Makefile
  • cache Go module downloads and Go build artifacts in the Docker build
  • remove forced full recompilation flags from the Go build step
  • avoid duplicate npm install work in the dashboard image build
  • reorder dashboard build layers to maximize cache hits
  • shrink the Docker build context with .dockerignore
  • add NO_CACHE=1 support to map to docker build --no-cache

Why

Local make deploy iterations 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 .
  • repeated docker build reuses cached layers successfully
  • make build IMAGE_TAG=feat-speed-build-make-test BUILD_CONTEXT=.
  • make -n build BUILD_CONTEXT=. IMAGE_TAG=dry-run-test
  • make -n build BUILD_CONTEXT=. IMAGE_TAG=dry-run-test NO_CACHE=1

Impact

The default local workflow stays the same:

  • make deploy KUBE_CONTEXT=kind-oscar-test-mty

But 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

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.
@gmolto gmolto self-assigned this Apr 6, 2026
@gmolto gmolto marked this pull request as ready for review April 6, 2026 15:09
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