I referred to the similar question, but following this method added all the files in the parent directory to the build context making it more than 8gb in my case. So the question is how to copy files from the parent directory without adding files to build context
The structure of the project is
Project
|
|--docker-files
| |
| |-Dockerfile
|
|--Folder
| |
| |--file/to/be/copied
|
|--other files
Using the -f flag , the command is docker build -f docker-files/Dockerfile . -t name
which is executed in the Project directory
One of the solutions is to include the .dockerignore file but it very messy and the whole point of putting the docker file in a subfolder was to reduce the size of the build context.