I'm new to Kubernetes, and so I wonder what recommendations are best used to add the application source code to a container in Kubernetes or a similar environment?
My application is PHP, so I have PHP (fpm) and Nginx containers (powered by Google Container Engine)
At first I had a git volume, but it was not possible to change such versions of applications, so I switched to emptyDir and installed the source code in a zip archive on one of the images that will unzip it to this volume after the start and now I have the source code , separate on both images via git with a separate git directory, so I have / app and / app-git.
This is good because I donโt need to exchange or configure volumes (less resources and configuration), the application layer is reused in both images, therefore there is no effect on the space and since it is git, the โbaseโ is built-in so I can simply configure the dockerfile command at the end and easily switch to another branch or tag.
I wanted to download the source archive directly from the repository, providing credentials as arguments during the build process, but that didnโt work because my repo, bitpack, creates archives with the last commit identifier added to the directory, so there was no way knowing what will lead to unpacking the archive, so I'm stuck in git itself.
What are your ways of handling source code?
source share