How would I handle a dev environment /data directory with a production environment volume /data?

I am developing a website where I would have a user create some categories with some image uploads. A database will hold information about the category such as name and destination of the image. Typically in the development environment I have a local directory /data, in order to test functionality. I have also created a volume with a [mounts] → destination:/data. When it comes to deploying the website how would I ensure that the dev data is also uploaded to the corresponding volume. When it comes to creating new images or deleting existing ones on the production, how would I typically handle it? Ensuring both that the destination of the image is consistent across development and production instances. Because from my understanding local /data would differ from volume /data. So I need to ensure that the destination written in the database would work in both the dev and prod environment, while also having the appropriate file in a directory stored both in dev and prod.

Do you need the file local on the machine? If not, and if you really need two servers in sync, it may be best to store the file on something like S3 or Tigris and save the URL in your database. Then whatever process you use to synchronize your database would bring over the latest image URLs.

Tigris actually sounds like a really nice option. Would I need a volume then?

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.