Skip to content

Commit 0850833

Browse files
gloursndeloof
authored andcommitted
change ssh type to string and update ssh section with contributors feebacks
Signed-off-by: Guillaume Lours <[email protected]>
1 parent 0de6875 commit 0850833

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

build.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ args:
161161

162162
`ssh` property syntax can be either:
163163
* `default` - let the builder connect to the ssh-agent.
164-
* `ID=socket` - a key/value definition of an ID and the associated socket
165-
* `ssh` without any value which is a shortcut of the `default` configuration
164+
* `ID=path` - a key/value definition of an ID and the associated path. Can be either a [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) file, or path to ssh-agent socket
165+
* `{}` (no value) which is a shortcut of the `default` configuration
166166

167167
`ssh` without any parameter
168168
```yaml
@@ -177,12 +177,16 @@ build:
177177
context: .
178178
ssh: default # mount the default ssh agent
179179
```
180-
Using a custom id `myproject` which will be use in the Dockerfile (i.e., `RUN --mount=type=ssh,id=myproject git clone ...`)
180+
Using a custom id `myproject` with path to a local SSH key:
181181
```yaml
182182
build:
183183
context: .
184184
ssh: myproject=~/.ssh/myproject.pem
185185
```
186+
Image builder can then rely on this to mount SSH key during build.
187+
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:
188+
189+
`RUN --mount=type=ssh,id=myproject git clone ...`
186190

187191
### cache_from
188192

schema/compose-spec.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"context": {"type": "string"},
9292
"dockerfile": {"type": "string"},
9393
"args": {"$ref": "#/definitions/list_or_dict"},
94-
"ssh": {"$ref": "#/definitions/string_or_list"},
94+
"ssh": {"type": "string"},
9595
"labels": {"$ref": "#/definitions/list_or_dict"},
9696
"cache_from": {"type": "array", "items": {"type": "string"}},
9797
"cache_to": {"type": "array", "items": {"type": "string"}},

0 commit comments

Comments
 (0)