Skip to content

feat: optimize prisma binary targets and transition docker base to no…#256

Merged
dDevAhmed merged 5 commits into
DigiNodes:mainfrom
whitezaddy:feat/prisma-docker-optimization
May 30, 2026
Merged

feat: optimize prisma binary targets and transition docker base to no…#256
dDevAhmed merged 5 commits into
DigiNodes:mainfrom
whitezaddy:feat/prisma-docker-optimization

Conversation

@whitezaddy
Copy link
Copy Markdown
Contributor

…de:alpine
closes #192

Submission Description

Updated Docker and Prisma build configuration to reduce Prisma binary footprint in Docker and enforce Alpine-compatible engine targets.

What changed

  • Converted Dockerfile to a multi-stage node:20-alpine build
  • Added npm prune --production in builder stage to remove dev dependencies from final image
  • Restricted Prisma client engine binaries in schema.prisma with:
    • binaryTargets = ["native", "linux-musl"]
  • Added engines.node = ">=20 <21" to package.json
  • Added .dockerignore to reduce Docker build context
  • Added a Jest regression test in dockerfile.spec.ts to verify build config and Prisma engine settings

Why

  • Minimize Docker image size by avoiding unnecessary runtime artifacts
  • Ensure Prisma generates only Alpine-compatible binaries for Docker
  • Lock Node version compatibility to the intended runtime environment
  • Provide automated verification that Docker/Prisma config remains correct

Verification

  • Ran npm install --ignore-engines --no-audit --no-fund
  • Executed dockerfile.spec.ts
  • Result: 1 passed, 5 passed, 5 total

Summary

This change addresses the Prisma binary size issue in Docker by optimizing the container build and restricting Prisma engines to Alpine-compatible output, while adding test coverage to prevent regressions.

@whitezaddy
Copy link
Copy Markdown
Contributor Author

@dDevAhmed Hi maintainers, I've refactored the multi-stage Docker build layers and locked down the specific Prisma engine binary targets to Alpine targets as requested. Whenever you have a free moment, could you please approve the CI workflow runner so the integration builds, lints, and test suites can execute? Thank you!

@dDevAhmed dDevAhmed merged commit 3fb35bd into DigiNodes:main May 30, 2026
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.

Prisma binary size in Docker

2 participants