New to CI/CD, please help with customization workflow

Hi there,

I’ve been looking at Erpnext and I wanted to ask some more experienced users (or devs?) what would be the best way of introducing some sort of CI/CD workflow.
My main goal is to modify ERPnext and other applications in a non-invasive way (without moidfying the core structures), by adding custom fields and doctypes.
I want to have test, pre-production (staging?) and production environment. Maybe with a 4th one, the local dev.

The application would be deployed using Docker Compose, just as shown in the docs.

Here’s what I think I should be doing:

  1. Fork/clone erp, hrms, frappe, all the other apps from Github to my repository (at least I think I have to do it to track changes of my custom stuff?)
  2. Create apps.json file pointing to my repositories with the apps
  3. Build a docker file with this apps.json file
  4. Deploy built docker file as production environment
  5. Clone the production env into the test environment (a separate Docker installation)
  6. Make changes on test/dev env (inside UI), with the changes being tracked in my Git repository
  7. After making all the changes in test env, build a new version of the container with test env changes applied

At this point I would have a working container with changes made in the apps.
Now for the staging and final production deployment:

  1. Clone prod environment database to staging env, while using the new container in staging env (so “old” production database with new, test-env application). If I understand bench correctly, at this point the schema changes would get applied from the “new” application container files, to the database.
  2. If staging deploy works without issues, apply the new container version to production environment.

I am not at all experienced with CI/CD and using Git for production cycles, so sorry if that makes no sense at all lol.
Please let me know if I’m at least looking in a good direction.

If possible, I would also like to ask what should happen when I want to upgrade the Frappe apps in this scenario; Do I merge new changes from the Frappe Github to my repository and carry on just as these were my changes? Will (some of) my custom changes get overwritten?

Check this,

https://castlecraft.gitlab.io/frappe-manual/devops/ci-cd-workflow/

Unfortunately, these documents seem a bit too advanced for me, at least for now. Like I said, I’m just starting out with this type of deployment project and have no experience in any CI/CD tools and vocabulary.
For now I’d like to know if the scenario I created above would work and make practical sense, or if there’s a better way to do this at my entry level.