Currently I have a laravel app which source code is being built on gitlab and then a docker image is pushed to registry containing the source code rand unning laravel on php-fpm+nginx when container is run. I have deployed this on Rancher 2.3.2 running one workload. So whenever there is a code change, a new docker image is built and re-deployed.
What I am looking for is if its possible to run separate nginx container(workload) which then uses data (laravel code) from php-fpm container(workload). So it would make 2 separate workloads, but only laravel php container should have to be built and re-deployed whenever there is a change in a code. This could let me also add separate cronjob container(workload) later on which would also use data only from php-fpm container etc. Is this possible?
I believe this is somehow possible with volumes, but when I try to mount a new PV to my workload under /var/www/ (this is where laravel code is), and then deploy workload, everything is empty under /var/www/ inside container as it overrides everything from hostPath.
What I would like to know is if this can be done and maybe I am imagining it completely wrong. Is there any best practice for such services running on Rancher?