Strapi v4 deploy on DigitalOcean overwrites the uploads folder including the images

System Information
  • Strapi Version: last
  • Operating System:
  • Database:
  • Node Version: postgres

Hello,

I have a github master branch linked to my Droplet DigitalOcean to deploy Strapi, that’s works without problem but when I upload images to the “Media Gallery” and I restart a build my folder “public/uploads” with all this images are deleted and the links are broken.

How can I have use this folder to upload my medias and don’t have this problem every time I rebuild Strapi on DigitalOcean ?
I don’t want use Space AWS3 or other CDN service.

Thanks.

How are you running it on the do droplet?

Droplet Basic Plan
Ubuntu 18.04 stack

Linked to GitHub, my master branch with autodeploy is activated.
The public folder is by default in my branch like the .gitignore informations.

public/uploads/*
!public/uploads/.gitkeep

Build Command
npm run build (“strapi build”)

Run Command
npm start ( “strapi start”)

STRAPI VERSION
v4.3.6

NODE VERSION
v16.19.0

EVENTS DIGITALOCEAN
1 Node.js Buildpack v0.3.4
Buildpack Docs
Install dependencies using NPM or Yarn
2 Procfile Buildpack v0.0.3
Configure default run commands from the Procfile if one exists
3 Custom Build Command Buildpack v0.1.1
Buildpack Docs
npm run build

Thank you for helping me.

I’m going to guess that it runs in a container when it starts, meaning it kills what is inside public/uploads.
You will need to use S3 or other storage options.
Or bind mount the folder to a physical disk etc so it persists container restarts