Skip to content

Commit

Permalink
Add ssh definition to the service build section
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
  • Loading branch information
glours authored and ndeloof committed Mar 9, 2022
1 parent 4a91484 commit 757324d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
27 changes: 27 additions & 0 deletions build.md
Expand Up @@ -155,6 +155,33 @@ args:
- GIT_COMMIT
```

### ssh

`ssh` defines an SSH authentication that the image builder SHOULD use during image build (e.g., cloning private repository)

ssh property syntax MUST follow the global format `[default|<ID>[=<socket>|<KEY>[,<KEY>]]]`.
Using the `ssh` without any parameter or just `default` is actually a shortcut notation for `default=${SSH_AUTH_SOCK}`.

`ssh` without any parameter
```yaml
build:
context: .
ssh: # mount the default ssh agent
```

Simple`default` sample
```yaml
build:
context: .
ssh: default # mount the default ssh agent
```
Using a custom id `myproject` which will be use in the Dockerfile (i.e., `RUN --mount=type=ssh,id=myproject git clone ...`)
```yaml
build:
context: .
ssh: myproject=~/.ssh/myproject.pem
```

### cache_from

`cache_from` defines a list of sources the Image builder SHOULD use for cache resolution.
Expand Down
1 change: 1 addition & 0 deletions schema/compose-spec.json
Expand Up @@ -91,6 +91,7 @@
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"},
"ssh": {"$ref": "#/definitions/string_or_list"},
"labels": {"$ref": "#/definitions/list_or_dict"},
"cache_from": {"type": "array", "items": {"type": "string"}},
"cache_to": {"type": "array", "items": {"type": "string"}},
Expand Down

0 comments on commit 757324d

Please sign in to comment.