Docker image layer#148
Open
gloskull wants to merge 2 commits into
Open
Conversation
…ing-for-ci Optimize Docker image layer caching in CI
Contributor
|
resolve conflicts @gloskull |
3 similar comments
Contributor
|
resolve conflicts @gloskull |
Contributor
|
resolve conflicts @gloskull |
Contributor
|
resolve conflicts @gloskull |
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.
Motivation
Reduce CI build time by reusing Docker and Next.js build layers across runs to improve developer feedback loops and lower resource usage.
Produce a minimal, non-root runtime image by leveraging Next.js standalone output so the runtime stage only contains required artifacts.
Document the caching architecture and operational runbook so teams can monitor cache reuse and troubleshoot build regressions.
Description
Add a multi-stage Dockerfile that uses BuildKit cache mounts for the npm cache and .next/cache, and produces a small non-root runner image from Next.js output: "standalone" (see next.config.ts).
Add a .dockerignore to keep dependencies, build outputs, test artifacts, VCS metadata, env files, and docs out of the build context.
Extend the Frontend CI workflow to restore the Next.js build cache with actions/cache@v4 and add a docker-image job that builds with docker/build-push-action@v6 using GitHub Actions layer cache (type=gha) with cache-from/cache-to configured.
Add helper npm scripts docker:build and docker:build:plain for local parity with the CI build process and add a runbook under docs/runbooks/docker-ci-layer-caching.md describing architecture, monitoring, deployment guidance, and troubleshooting.
Testing
npx tsc --noEmit completed successfully.
npm run lint failed due to pre-existing unused-variable lint errors in src/components/map/AssetHeatmapLayer.tsx (existing code issue, not introduced by these CI/Docker changes).
npm test (vitest --run) failed with 3 pre-existing test failures in tests/components/AssetHeatmapLayer.test.tsx and tests/unit/keyCache.test.ts (failures unrelated to Docker/CI additions).
npm run build (Next.js build) failed in this environment because the build could not fetch Google-hosted fonts, and docker build could not be executed here because Docker is not available in the execution environment.
Closes #127