Merge branch 'docker:master' into master (#13682)

* Specify `services` in compose file example
* Specify compose file version required to use for `depends_on`
This commit is contained in:
Dan Bamikiya 2021-10-15 11:52:37 +01:00 committed by GitHub
parent 1466adf41a
commit d17061c1ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -30,11 +30,12 @@ If you are using these build environment variables in a
service's environment as shown below.
```none
sut:
build: .
command: run_tests.sh
environment:
- SOURCE_BRANCH
services:
sut:
build: .
command: run_tests.sh
environment:
- SOURCE_BRANCH
```

View File

@ -25,9 +25,10 @@ contains the Dockerfile used to build the image.
For example:
```none
sut:
build: .
command: run_tests.sh
services:
sut:
build: .
command: run_tests.sh
```
The example above builds the repository, and runs the `run_tests.sh` file inside
@ -37,10 +38,8 @@ You can define any number of linked services in this file. The only requirement
is that `sut` is defined. Its return code determines if tests passed or not.
Tests **pass** if the `sut` service returns `0`, and **fail** otherwise.
> **Note**: Only the `sut` service and all other services listed in `depends_on`
are started. For instance, if you have services that poll for changes in other
services, be sure to include the polling services in the `depends_on` list to
make sure all of your services start.
> **Note**: Only the `sut` service and all other services listed in [`depends_on`](https://docs.docker.com/compose/compose-file/compose-file-v2/#depends_on) are started. For instance, if you have services that poll for changes in other services, be sure to include the polling services in the [`depends_on`](https://docs.docker.com/compose/compose-file/compose-file-v2/#depends_on) list to make sure all of your services start.
Also make sure to include a compose file version from 2.0 upward as `depends_on` was added in [version 2.0](https://docs.docker.com/compose/compose-file/compose-versioning/#version-2) file format.
You can define more than one `docker-compose.test.yml` file if needed. Any file
that ends in `.test.yml` is used for testing, and the tests run sequentially.