Skip to content

Commit

Permalink
change ssh property to a simple collection (list or dict)
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
  • Loading branch information
glours committed Mar 8, 2022
1 parent 52c501e commit 743ccca
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 5 additions & 3 deletions build.md
Expand Up @@ -157,7 +157,7 @@ args:

### ssh

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

`ssh` property syntax can be either:
* `default` - let the builder connect to the ssh-agent.
Expand All @@ -167,13 +167,15 @@ Simple`default` sample
```yaml
build:
context: .
ssh: default # mount the default ssh agent
ssh:
default # mount the default ssh agent
```
Using a custom id `myproject` with path to a local SSH key:
```yaml
build:
context: .
ssh: myproject=~/.ssh/myproject.pem
ssh:
- myproject=~/.ssh/myproject.pem
```
Image builder can then rely on this to mount SSH key during build.
For illustration, [Buildkit extended syntax](https://github.com/compose-spec/compose-spec/pull/234/%5Bmoby/buildkit@master/frontend/dockerfile/docs/syntax.md#run---mounttypessh%5D(https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#run---mounttypessh)) can be used to mount ssh key set by ID and access a secured resource:
Expand Down
7 changes: 1 addition & 6 deletions schema/compose-spec.json
Expand Up @@ -91,12 +91,7 @@
"context": {"type": "string"},
"dockerfile": {"type": "string"},
"args": {"$ref": "#/definitions/list_or_dict"},
"ssh": {
"oneOf": [
{"type": "string"},
{"$ref": "#/definitions/list_or_dict"}
]
},
"ssh": {"$ref": "#/definitions/list_or_dict"},
"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 743ccca

Please sign in to comment.