diff --git a/build.md b/build.md index 0f50ed83..6145c16b 100644 --- a/build.md +++ b/build.md @@ -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|[=|[,]]]`. +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. diff --git a/schema/compose-spec.json b/schema/compose-spec.json index 91a34735..8384daaa 100644 --- a/schema/compose-spec.json +++ b/schema/compose-spec.json @@ -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"}},