Skip to content

ci: fix Docker builder-stage layer caching#159

Closed
jakebromberg wants to merge 1 commit intotask/reduce-ci-minutesfrom
ci/docker-layer-caching
Closed

ci: fix Docker builder-stage layer caching#159
jakebromberg wants to merge 1 commit intotask/reduce-ci-minutesfrom
ci/docker-layer-caching

Conversation

@jakebromberg
Copy link
Member

Summary

  • Restructure builder stages in Dockerfile.backend and Dockerfile.auth to copy package manifests before source code
  • Replace npm install with npm ci for deterministic, faster dependency resolution
  • Add package-lock.json to builder stage (was missing, causing non-deterministic installs)

This enables Docker layer caching for the npm ci step: when only source code changes (the common case), the dependency layer is reused instead of rebuilt.

Estimated savings

~1-2 minutes when code changes but dependencies don't (most CI runs)

Test plan

  • CI Docker build steps show cache hits for the npm ci layer when only source changed
  • Docker images build and run correctly (integration tests pass)
  • Local Docker builds still work

Both Dockerfiles copied source code before npm install in the builder
stage, invalidating the dependency cache on every code change. Restructure
to copy package manifests first, run npm ci (deterministic), then copy
source and build. This enables Docker layer caching for the npm ci step
when only source code changes (the common case).
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