Changing location of .dockerignore when when changing context of a build

I am trying to setup docker-compose scripts in a repo next to our app repo. I can change context and set the Dockerfile like so:

    build: 
      context: ../
      dockerfile: ./docker-scripts/Dockerfile

However the CLI still looks for the .dockerignore at the root directory. Is it possible to change the location of the .gitignore like you can with the dockerfile?

Thank you

For reference:
Before the docker CLI sends the context to the docker daemon, it looks for a file named .dockerignore in the root directory of the context. If this file exists, the CLI modifies the context to exclude files and directories that match patterns in it.


and Compose doc without any mention of .gitignore

I have just has similar issue.
I have moved my compose file and docker file in distinct separate directories from my application directory but I still need to copy my application direction into the container minus some files.
I wasn’t sure whether the .dockerignore is to be alongside the compose file, the docker file or in the application content directory that I need to copy.
The two part resolution for me was:
(1) I needed to set my docker-compose context to point to root of application directory as a path relative to the compose file (…/… in my case)
(2) the .dockerignore needs to be present at the location where the context is set up to.