We run a Yii2 PHP webapp in Docker.
At first, for simplicity, we only had one container running both nginx and fpm (using supervisord), almost the same as running the webapp on a server…
For sake of load balancing and scalability, we are now using the vanilla nginx image (with a template and a customization script) for the frontend, and a webapp image based on FPM one and including the app source code.
The webapp is 99% PHP, and 1% is served directly from the
web directory by nginx. That dir is the vhost webroot, containing the
index.php entry script and static content (js/css). This static content can be either from repo or generated (published) by the PHP/webapp container.
At this stage, the
compose project file shares the
web subdir from the
php service to the
nginx one using a volume, which I need to delete and recreate after an upgrade, to make sure the static files are refreshed (not generated ones).
My concern is about this shared directory: I was wondering if there’s a better approach for allowing the nginx frontend to read files which are only on the backend service.