Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

8.5.2.2. Dockerfile 路径

默认情况下,Docker 构建使用位于 BuildConfig.spec.source.contextDir 字段中指定的上下文的根目录的 Dockerfile(名为 Dockerfile)。

dockerfilePath 字段允许构建使用不同的路径来定位 Dockerfile,该路径相对于 BuildConfig.spec.source.contextDir 字段。它可以只是默认 Dockerfile 以外的其他文件名(如 MyDockerfile),或子目录中 Dockerfile 的路径(如 dockerfiles/app1/Dockerfile):

strategy:
  dockerStrategy:
    dockerfilePath: dockerfiles/app1/Dockerfile