Installing PHP Composer using yml file

Hi, experimenting with setting up my first docker stack.
I’m trying to install PHP Composer in to the directory above the WWW, as part of the build.
The stack runs fine however there is nno “vendor” or “composer.json” file created. From my understanding it has something to do with docker overwriting the Volume mappings and wiping out the files…
Tried following some on line tutorials but not much joy.
Any idea how I should edit my compose.yml file?
Cheers

version: “2.1”
services:
nginx:
image: lscr.io/linuxserver/nginx:latest
container_name: nginx
environment:
- PUID=1029
- PGID=100
- TZ=Etc/GMT
volumes:
- /volume1/docker/devserver:/config

ports:
  - 80:80
  - 443:443
restart: unless-stopped

composer:
image: composer
container_name: composer
command: install --no-suggest
restart: ‘no’ # Don’t want to update composer everytime we restart the server

    environment:
    - PUID=1029
    - GUID=100
    - COMPOSER_ALLOW_SUPERUSER=1    

    volumes:
    - /volume1/docker/devserver/scripts_vault:/app