I currently have a new server setup where I have Docker running. I use Gitlab CI to create and push new images. I just fail to determine how to deploy/setup my project files and docker images.
To understand my situation, imagine having a PHP project with the following folder structure
- system
- src
- public
- users
- uploads
This is a made-up structure but does reflect the situation where everything except the uploads folder contains PHP scripts.
I could now either go with a separate nginx and php image to run this project, or with a single image containing both these services.
However, this is where my question marks appear. What approach should I take?
Because:
- Creating both a nginx and php image would duplicate my project files over both images, making 2x100mb images. Sidenote: uploads will be mounted from the host system.
- Creating 1 single image with both services should eliminate the above but comes with other problems, e.g. logging and service management.
- Creating a data container would also resolve the 2 image sizes and eliminate the problems from point 2, but this is considered bad practices.
- According to the documentation I am supposed to use data volumes on host to share data between the containers. This would eliminate the data container, but I would than have to have my build process also deploy the project files to the shared data volume, which I think I'd rather not have as this somewhat defeats the purpose of having containers.
- I also don't see how the previous point (point 4 to be precise) should work/be setup. Would I have a build step in Gitlab that creates a volume and copies all the project files to the volume to mount it at a later time to the php and nginx containers?
Also, I just run docker on my server, as I have no need for solutions like Kubernetes or Rancher.
No comments:
Post a Comment