Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions content/manuals/compose/how-tos/dependent-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,38 @@
b:
image: service_b
build:
context: b/
dockerfile: b.Dockerfile
additional_contexts:
# `FROM service_a` will be resolved as a dependency on service a which has to be built first
service_a: "service:a"
# `FROM service_a` will be resolved as a dependency on service "a" which has to be built first
service_a: "service:a"
```
Using additional context, you can refer to image built by another service without the need to explictly name it:

Check failure on line 108 in content/manuals/compose/how-tos/dependent-images.md

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [Vale.Spelling] Did you really mean 'explictly'? Raw Output: {"message": "[Vale.Spelling] Did you really mean 'explictly'?", "location": {"path": "content/manuals/compose/how-tos/dependent-images.md", "range": {"start": {"line": 108, "column": 95}}}, "severity": "ERROR"}
b.Dockerfile:
```dockerfile

FROM base_image
# `base_image` doesn't resolve to an actual image. This is used to point to a named additional context

# build service b
```

Compose file:

```yaml
services:
a:
build:
dockerfile: a.Dockerfile
# built image will be tagged <project_name>_a
b:
build:
dockerfile: b.Dockerfile
additional_contexts:
# `FROM base_image` will be resolved as a dependency on service "a" which has to be built first
base_image: "service:a"
```
## Build with Bake
Expand Down