<p>I need to somehow run my PHP application in Swarm (maybe we will consider kubernetes if it will be easier). We want to keep nginx and php containers separate, so we can scale them independently. But there is the problem, nginx must have access to those static files somehow.</p>

<p>How would you solve this situation?</p>

<p>Our first idea would be that in the CI, versioned compiled assets would be included to Nginx image. But what to do when i want to update my application containers? I would need old and also the new assets. Or should I use some kind of persisted volume and update it with CI? But I'm no sure how can I do that...</p>

Snipo
<p>The persisted volume is probably the best way to accomplish this. Docker containers can mount NFS volumes. Create a container to act as an NFS server for the shared files. Here is one of the many containers available on Docker Hub: <a href="https://hub.docker.com/r/itsthenetwork/nfs-server-alpine/" rel="nofollow noreferrer">https://hub.docker.com/r/itsthenetwork/nfs-server-alpine/</a></p>

<p>Here is an example of how to set up NFS volumes for use with containers. <a href="https://gist.github.com/ruanbekker/4a9c0d250bce9f84482f2a788ce92131" rel="nofollow noreferrer">https://gist.github.com/ruanbekker/4a9c0d250bce9f84482f2a788ce92131</a></p>

<p>Keep in mind that the server address will need to be that of the NFS container.</p>
