In my project, Dockerfiles are not stored in the same place that the files I want to COPY in my image. Like :
root
     Dockerfiles:
          app_name1:
              dockerfile1
          ...
    folder
          app1
          app2
          ...
cloudbuild
I have a cloudbuild.yaml like that :
steps:
- name: gcr.io/cloud-builders/docker
  args:
  - build
  - '--tag=eu.gcr.io/$PROJECT_ID/${_IMAGE_NAME}:${_STAGE}'
  - **'-f ./Dockerfiles/${_IMAGE_NAME}/Dockerfile'**
  - .
images: [
    'eu.gcr.io/$PROJECT_ID/${_IMAGE_NAME}'
]
and I build the image from root like that :
gcloud builds submit .
      --config=cloudbuild.yaml
      --substitutions [...]
      .
I checked inside my GCP Bucket, the source specified in gcloud submit (.) is successfuly uploaded and so should be accessible in ./workspace/.
But the build fails with the following error :
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /workspace/ .: no such file or directory
It seems like he doesn't want to use the Dockerfile specified in the --file argument. And I can't manage to find an exemple of cloudbuild.yaml using this argument. Any idea on what's happening ?