fix: add backend .dockerignore and fix build stage dependencies#908
Conversation
|
your branch is green, but it went conflicting after the ci fixes landed on main: #969 and #974 touched backend/Dockerfile and backend/src/workers/soroban-event-worker.ts, which this pr also edits. please rebase on main and it should be good to go: |
8374d6a to
68bc7c0
Compare
ogazboiz
left a comment
There was a problem hiding this comment.
the .dockerignore is right (node_modules, dist, coverage, .env*, logs, src/generated), and it doesn't touch the prisma.config.ts copy so no conflict with the docker ci. merging. heads up the title says fix build but the only Dockerfile change is a trailing-newline removal, no actual build fix (cosmetic).
Summary of Contributions
1. Optimized Docker Build Context
backend/.dockerignore: Excluded heavy and sensitive directories/files (such asnode_modules,dist,coverage,.env*,*.log, andsrc/generated) from being sent to the Docker daemon. This significantly drops the build context size and mitigates the risk of leaking sensitive environment variables into the build layers.2. Fixed Backend Dockerfile Multi-Stage Build
builderstage to execute a fullnpm installinstead of restricting dev dependencies. This ensures that essential CLI tools required for compilation (like TypeScript and Prisma) are fully available during the build phase.COPY prisma ./prismadirective into thebuilderstage to resolve a critical build failure where the compilation script could not locate the required database schema file.--omit=devflag in the finalrunnerstage to keep the production container image as lightweight, secure, and lean as possible.