Created attachment 1512015 [details]
oc explain output
Description of problem:
In build config, when docker strategy is used, user can specify:
* source git repo
* context dir
* Dockerfile content
But user cannot specify Dockerfile path. There must be a file called `Dockerfile` inside contextDir. The file cannot be called `Dockerfile.rhel7`, `jenkins/Dockerfile.centos` or `prow/Dockerfile` for example.
Specifying Dockerfile content inside build config is not really useful, because changes to Dockerfile in code cannot be reflected automatically into the build config.
This is limiting how one project can have multiple Dockerfiles for different use cases.
As an example see verification-tests repo . We have a pair of Dockerfiles in tools/jenkins/slaves, then another one tools/openshift-ci/Dockerfile.centos
All of these Dockerfiles require scripts tools/install_os_deps.sh and tools/hack_bundle.rb. Now trying to create a build configs in OCP, I first need to move all Dockerfiles to separate directories and set contextDir to the appropriate directory. But then the scripts fall out of the contextDir, thus they cannot be accessed by the build.
My workaround is to clone repo inside the Dockerfile by calling `git clone`. This is suboptimal though, because it makes testing Dockerfile locally before pushing the code to repo hardly possible without doing temporary changes to Dockerfile.
All other container build tools I know allow you to specify some custom PATH to Dockerfile while keeping context dir to the root of the repo. I understand this is a feature often used by many projects. I think OpenShift build config needs also to support this for a good user/dev experience on this platform.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. oc explain buildconfig.spec.source
* no option to specify Dockerfile PATH (see attached oc output)
* there is option to specify Dockerfile path within contextDir
You can actually specify the dockerfile_path in your build strategy , and keep the context_dir to "."
Of course, you will have to have a `git_source`  to make the build to clone your repository. You don't need to specify `contextDir` and `Dockerfile` in your source.
Thank you very much. I looked mainly at `source` element and didn't notice all the options under `dockerStrategy` element. It works like a charm. Also thinking about it I now make sense out of having these under different elements.
btw very useful is also
> imageOptimizationPolicy: SkipLayers
So this is not actually a bug.