mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix: add docker cache for pnpm installations
This commit is contained in:
@@ -75,6 +75,10 @@
|
||||
- `apps/edr-passenger-api/docker-entrypoint.sh`
|
||||
- `apps/edr-passenger-api/prisma/seed.ts`
|
||||
- `infrastructure/docker/Dockerfile.passenger-web` (NEW)
|
||||
- `apps/edr-freight-api/Dockerfile` (MODIFIED — pnpm store cache)
|
||||
- `apps/edr-passenger-api/Dockerfile` (MODIFIED — prisma generate in /deploy + pnpm store cache)
|
||||
- `apps/edr-payment-api/Dockerfile` (MODIFIED — pnpm store cache)
|
||||
- `infrastructure/docker/Dockerfile.web` (MODIFIED — pnpm store cache)
|
||||
- `apps/edr-passenger-web/portal/next.config.js` (MODIFIED)
|
||||
- `apps/edr-passenger-web/backoffice/next.config.js` (MODIFIED)
|
||||
- `DEPLOYMENT.md` (MODIFIED)
|
||||
@@ -85,6 +89,22 @@
|
||||
- `live/page.tsx` — replaced stub with real LiveTrackingPage using `liveApi` (trips, crowd signals, delay/status stats)
|
||||
- `notifications/page.tsx` — replaced hardcoded mock + broken `Table` import with real page using `notificationsApi` (templates list, send form, notification history tab)
|
||||
|
||||
## Prisma Client Missing After `pnpm deploy` (Latest)
|
||||
|
||||
20. Fixed passenger API crash in Docker (`TypeError: Cannot convert undefined or null to object` at `class-validator` `IsEnum`, triggered by `dist/modules/fare-engine/currency.dto.js`):
|
||||
- Root cause: `currency.dto.ts` imports the `Currency` enum (a runtime value) from `@prisma/client`. The generated Prisma client is an output of `prisma generate`, not a package in the pnpm store, so `pnpm deploy` did not copy it into `/deploy`. At runtime `Currency` resolved to `undefined` → `@IsEnum(undefined)` → `Object.entries(undefined)` throws at module load.
|
||||
- Prisma 6 + pnpm writes the client to `node_modules/.pnpm/@prisma+client@.../node_modules/.prisma/client`, **not** root `node_modules/.prisma`. The old `cp` rescue in the Dockerfile guarded on `[ -d node_modules/.prisma ]` (root) which never existed → silently skipped.
|
||||
- Fix in `apps/edr-passenger-api/Dockerfile`: replaced the broken `cp` with `RUN cd /deploy && npm run prisma:generate` after `pnpm deploy`, regenerating the client into the exact runtime-resolve path (`/deploy/node_modules/.prisma/client`). Safe because deploy has no `--prod` flag (so the `prisma` CLI ships) and `package.json` declares the schema path.
|
||||
- Affected 16 passenger-api files importing from `@prisma/client`; `currency.dto.js` just loaded first. payment-api unaffected (TypeORM, no Prisma).
|
||||
|
||||
## pnpm Store Build Cache Fix (Latest)
|
||||
|
||||
21. Fixed Docker builds re-downloading all dependencies every pipeline run:
|
||||
- Root cause: install steps used `--mount=type=cache,id=pnpm,target=/pnpm/store`, but nothing set pnpm's store-dir to `/pnpm/store`. Default store (`~/.local/share/pnpm/store`) was never under the mount → BuildKit cached an empty dir → full re-download each build. The two web Dockerfiles had the mount but it was dead; the two API Dockerfiles (freight, payment) had no mount at all.
|
||||
- Fix: added `ENV PNPM_HOME="/pnpm"` (+ PATH) to the `base` stage of all 5 Dockerfiles so the store resolves to `/pnpm/store`, matching the mount. Added the cache mount to every `pnpm install` and `pnpm deploy` step that lacked it.
|
||||
- Files: `apps/edr-freight-api/Dockerfile`, `apps/edr-passenger-api/Dockerfile`, `apps/edr-payment-api/Dockerfile`, `infrastructure/docker/Dockerfile.web`, `infrastructure/docker/Dockerfile.passenger-web`.
|
||||
- Caveat: BuildKit cache mounts live on the runner host; persists only while the same self-hosted runner/builder is reused and not pruned (`docker builder prune` wipes it).
|
||||
|
||||
## Next Actions
|
||||
|
||||
1. Run full CI on all target branches (`main`, `dev`, `staging`) and verify matrix job behavior.
|
||||
|
||||
Reference in New Issue
Block a user