When the BuildConfig.spec.source.type
is Binary
, the build will expect a
binary as input, and an inline Dockerfile is optional.
The binary is generally assumed to be a tar, gzipped tar, or zip file depending
on the strategy. For Docker
builds, this is the build context and an
optional Dockerfile may be specified to override any Dockerfile in the build
context. For Source
builds, this is assumed to be an archive as described
above. For Source
and Docker
builds, if binary.asFile
is set the
build context will consist of a single file named by the value of binary.asFile
.
The contextDir
field may be used when an archive is provided. Custom builds will
receive this binary as input on standard input (stdin
).
A binary source potentially extracts content (if asFile
is not set), in which case contextDir
allows changing to a subdirectory within the content before the build executes.
The source definition is part of the spec
section in the BuildConfig
:
source:
git:
uri: https://github.com/sclorg/nodejs-ex.git
secrets:
- secret:
name: secret-npmrc
type: Git
To include the secrets in a new build configuration, run the following command:
$ oc new-build openshift/nodejs-010-centos7~https://github.com/sclorg/nodejs-ex.git
During the build, the .npmrc file is copied into the directory where the
source code is located. In case of the OpenShift Enterprise s2i builder images, this
is the image working directory, which is set using the WORKDIR
instruction
in the Dockerfile. If you want to specify another directory, add a
destinationDir
to the secret definition:
source:
git:
uri: https://github.com/sclorg/nodejs-ex.git
secrets:
- secret:
name: secret-npmrc
destinationDir: /etc
type: Git
You can also specify the destination directory when creating a new build
configuration:
$ oc new-build openshift/nodejs-010-centos7~https://github.com/sclorg/nodejs-ex.git
1 |
The binary field specifies the details of the binary source. |
2 |
The asFile field specifies the name of the file that will be created with
the binary contents. |
3 |
The contextDir field specifies a subdirectory within the extracted contents of a
binary archive. |
4 |
If the optional dockerfile field is provided, it should be a string
containing an inline Dockerfile that potentially replaces one within the
contents of the binary archive. |