Dockerfile based Template deletes volume on redeploy.

I have a working template that deploys my app and creates a volume to store data in.
I am seeing the volume get deleted when I click redeploy on the application. I'm doing this when the application code changes or I update the dockerfile. Is there a way to protect the volume from being deleted? Am I going about this in the wrong way?
12 Replies
Percy
Percy8mo ago
Project ID: 48a6a018-c24e-4001-b030-33c5da1ff3bd
meadowhawk
meadowhawkOP8mo ago
48a6a018-c24e-4001-b030-33c5da1ff3bd
Brody
Brody8mo ago
do you mean the contents of the volume is being deleted?
meadowhawk
meadowhawkOP8mo ago
yes, the db is deleted wehn I redeploy the app
Brody
Brody8mo ago
then the volume is not being used to store the data what path are you using in code and what path is the volume mounted to?
meadowhawk
meadowhawkOP8mo ago
hmm it is writing to the locaiton.. well unless I have the location wrong of course... I am writing to ./app/data and the volume was created as /data I got from the help doc that everythig runs in /app ? sot eh volume would be under that?
Brody
Brody8mo ago
yes so your mount point would need to account for that volumes are not mounted to the project folder, they are mounted at the root of the container
meadowhawk
meadowhawkOP8mo ago
ohh so the volume path would be ./data? while the app si running at ./app ?
meadowhawk
meadowhawkOP8mo ago
ok checking it out ahh I believe I ahve it backwards! so in the volumes mount path I would want to specify that as /app/data and in my app I would reference it as simply ./data
Brody
Brody8mo ago
assuming you have your WORKDIR set to /app yes
meadowhawk
meadowhawkOP8mo ago
OK, awesome I'll update and see if I get it now. Thank for the help!!
Want results from more Discord servers?
Add your server