Skip to content

fix: add backend .dockerignore and fix build stage dependencies#908

Open
Doiae9 wants to merge 1 commit into
LabsCrypt:mainfrom
Doiae9:fix/backend-dockerignore
Open

fix: add backend .dockerignore and fix build stage dependencies#908
Doiae9 wants to merge 1 commit into
LabsCrypt:mainfrom
Doiae9:fix/backend-dockerignore

Conversation

@Doiae9

@Doiae9 Doiae9 commented Jun 27, 2026

Copy link
Copy Markdown

Summary of Contributions

1. Optimized Docker Build Context

  • Added backend/.dockerignore: Excluded heavy and sensitive directories/files (such as node_modules, dist, coverage, .env*, *.log, and src/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

  • Dependency Resolution: Adjusted the builder stage to execute a full npm install instead of restricting dev dependencies. This ensures that essential CLI tools required for compilation (like TypeScript and Prisma) are fully available during the build phase.
  • Prisma Schema Inclusion: Added the COPY prisma ./prisma directive into the builder stage to resolve a critical build failure where the compilation script could not locate the required database schema file.
  • Production Optimization: Maintained the --omit=dev flag in the final runner stage to keep the production container image as lightweight, secure, and lean as possible.

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