Reducing build time and Docker image size for ERPNext / Frappe v15 builds

I’m running an ERPNext / Frappe v15 setup with the following apps.json:

frappe (version-15)
erpnext (version-15)
hrms (version-15)
india_compliance (version-15)
crm (main)
builder (version-15)
frappe_s3_attachment (version-15)
+ one private custom app (develop branch)

Currently, my Docker image build time is around 15–20 minutes, and the resulting image size is also quite large.
Most builds are triggered by frequent changes in the private custom app, not in the core apps.

I’m looking for community-recommended best practices to:

  • Reduce build time (especially during CI/CD)

  • Reduce final image size

  • Improve cache efficiency for Frappe/ERPNext Docker builds

with my little limited knowledge of docker i suggest you build a docker base image which is fixed (if you dont want the latest changes in frappe ecosystem)
If you want the latest maybe automate the build once every week to pick up the latest version updates
that should hopefully get you massive gains

@asieftejani This worked and reduced the build time from 15-20 mins to 4-6 mins.

Great to hear… all credit goes to ChatGPT :slight_smile: