Add support for build arguments
Allows 'build' configuration option to be specified as an object and adds support for build args. Signed-off-by: Garrett Heel <garrettheel@gmail.com>
This commit is contained in:
parent
77b4ebc31f
commit
9cfa71ceee
9 changed files with 297 additions and 49 deletions
|
|
@ -37,7 +37,8 @@ those files, all the [services](#service-configuration-reference) are declared
|
|||
at the root of the document.
|
||||
|
||||
Version 1 files do not support the declaration of
|
||||
named [volumes](#volume-configuration-reference)
|
||||
named [volumes](#volume-configuration-reference) or
|
||||
[build arguments](#args).
|
||||
|
||||
Example:
|
||||
|
||||
|
|
@ -89,6 +90,30 @@ definition.
|
|||
|
||||
### build
|
||||
|
||||
Configuration options that are applied at build time.
|
||||
|
||||
In version 1 this must be given as a string representing the context.
|
||||
|
||||
build: .
|
||||
|
||||
In version 2 this can alternatively be given as an object with extra options.
|
||||
|
||||
version: 2
|
||||
services:
|
||||
web:
|
||||
build: .
|
||||
|
||||
version: 2
|
||||
services:
|
||||
web:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-alternate
|
||||
args:
|
||||
buildno: 1
|
||||
|
||||
#### context
|
||||
|
||||
Either a path to a directory containing a Dockerfile, or a url to a git repository.
|
||||
|
||||
When the value supplied is a relative path, it is interpreted as relative to the
|
||||
|
|
@ -99,9 +124,46 @@ Compose will build and tag it with a generated name, and use that image thereaft
|
|||
|
||||
build: /path/to/build/dir
|
||||
|
||||
Using `build` together with `image` is not allowed. Attempting to do so results in
|
||||
build:
|
||||
context: /path/to/build/dir
|
||||
|
||||
Using `context` together with `image` is not allowed. Attempting to do so results in
|
||||
an error.
|
||||
|
||||
#### dockerfile
|
||||
|
||||
Alternate Dockerfile.
|
||||
|
||||
Compose will use an alternate file to build with. A build path must also be
|
||||
specified using the `build` key.
|
||||
|
||||
build:
|
||||
context: /path/to/build/dir
|
||||
dockerfile: Dockerfile-alternate
|
||||
|
||||
Using `dockerfile` together with `image` is not allowed. Attempting to do so results in an error.
|
||||
|
||||
#### args
|
||||
|
||||
Add build arguments. You can use either an array or a dictionary. Any
|
||||
boolean values; true, false, yes, no, need to be enclosed in quotes to ensure
|
||||
they are not converted to True or False by the YML parser.
|
||||
|
||||
Build arguments with only a key are resolved to their environment value on the
|
||||
machine Compose is running on.
|
||||
|
||||
> **Note:** Introduced in version 2 of the compose file format.
|
||||
|
||||
build:
|
||||
args:
|
||||
buildno: 1
|
||||
user: someuser
|
||||
|
||||
build:
|
||||
args:
|
||||
- buildno=1
|
||||
- user=someuser
|
||||
|
||||
### cap_add, cap_drop
|
||||
|
||||
Add or drop container capabilities.
|
||||
|
|
@ -194,6 +256,7 @@ The entrypoint can also be a list, in a manner similar to [dockerfile](https://d
|
|||
- memory_limit=-1
|
||||
- vendor/bin/phpunit
|
||||
|
||||
|
||||
### env_file
|
||||
|
||||
Add environment variables from a file. Can be a single value or a list.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue