Update:
I was able to build 2 pre-filled docker images for the backend and the database. And tested it with esm-patient-management e2e test workflow. And it was successful!
It takes less than 2 minutes to start the openmrs instance.
Earlier it took 15-20 minutes to start the openmrs instance.
The next step would be to automate the image building process and also optimize the docker image size.