Strapi lose all media when I publish a new version of my docker image

HI, strapi community,

My strapi installation loses media when I publish a new version of my docker image, maybe a problem with the mounted volume.

this is my docker-compose.yml

# path: ./docker-compose.yml

version: '3'
services:
  backend:
    container_name: backend
    build: .
    image: henochit/pgr-backend
    restart: always
    env_file: .env
    environment:
      DATABASE_CLIENT: ${DATABASE_CLIENT}
      DATABASE_HOST: pgrDB
      DATABASE_PORT: ${DATABASE_PORT}
      DATABASE_NAME: ${DATABASE_NAME}
      DATABASE_USERNAME: ${DATABASE_USERNAME}
      DATABASE_PASSWORD: ${DATABASE_PASSWORD}
      JWT_SECRET: ${JWT_SECRET}
      ADMIN_JWT_SECRET: ${ADMIN_JWT_SECRET}
      APP_KEYS: ${APP_KEYS}
      NODE_ENV: ${NODE_ENV}
    ports:
      - '1337:1337'
    depends_on:
      - pgrDB
    volumes:
      - ./app:/srv/app

  pgrDB:
    container_name: pgrDB
    platform: linux/amd64 #for platform error on Apple M1 chips
    restart: unless-stopped
    env_file: .env
    image: mysql:5.7
    command: --default-authentication-plugin=mysql_native_password
    environment:
      MYSQL_ROOT_PASSWORD: ${DATABASE_PASSWORD}
      MYSQL_PASSWORD: ${DATABASE_PASSWORD}
      MYSQL_DATABASE: ${DATABASE_NAME}
    volumes:
      - strapi-data:/var/lib/mysql
    ports:
      - '13306:3306'

volumes:
  strapi-data:

dockerfile :

FROM node:16-alpine
# Installing libvips-dev for sharp Compatability
RUN apk update && apk add  build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev
ARG NODE_ENV=development
ENV NODE_ENV=${NODE_ENV}
WORKDIR /opt/app
COPY ./package.json ./yarn.lock ./
# ENV PATH /opt/node_modules/.bin:$PATH
RUN yarn config set network-timeout 600000 -g && yarn install
# RUN yarn add --verbose --platform=linuxmusl --arch=x64 sharp
# WORKDIR /opt/app
COPY ./ .
RUN mv .env.staging .env
RUN yarn build
EXPOSE 1337
CMD ["yarn", "develop"]

You need to install a upload provider like strapi/packages/providers/upload-aws-s3 at main · strapi/strapi · GitHub or mount a pubic folder to be outside of your container

I mount a public folder but i have the same problem

I fix it with this config :

volumes:
      - ./public/uploads:/opt/app/public/uploads