As a practice I have pods with these 2 containers:
The image of my project is called testimage. The solution uses the 'testimage' as initContainer and then copies the all folders and files of the testimage into a shared volume called volume1. Then this volume is mounted into nginx and php-fpm containers with a Kubernetes volume mount.
When the size of testimage goes beyond 1gb (for example a magento2 project with full pre-built static data and compiled code), it takes a long time for copying these files and it seems like a bad practice.
Should I put the project files into the php-fpm container (first container)? For nginx to use it again, I have to copy paste data into a Kubernetes volume and then mount it to nginx.
The end solution is putting all app code + fpm + nginx into a single container than this makes a huge image with all of these. There is no per-container resource management and etc available with this solution.