I am pretty new at CI/CD integrations and have a lit bit of a problem.
Basically, I am using Docker + Kubernetes pipelines to deploy changes to my App. Everything works OK, but I ran into a problem.

My app creates some important files while running. I store those files in specific directory /modules/mymodule/generatedfiles. However, if I deploy new code changes – these files completely disappear. From what I understand this happens because my container restarts and those files were stored only in that container.

I have tried to use volume mounts, but that did not seem to help. If I understand correctly I need to somehow copy these files once I deploy?

One other example is that in my App I can create some Blog posts and upload some static images. These images are saved in /img/blog/ directory, but once again, if I deploy new code – images disappear.

Since my knowledge is very limited I do not understand is there an easy and correct way to achieve that these files would never disappear?

I tried to watch several videos and Google some information, however, I kinda ran into a wall since I can’t find a working solution.

From what I believe this should be a common issue since a lot of Apps create some kind of data.

Any help would be appreciated. Maybe someone could lead me to the correct path?
Thanks in advance