stdlib: added support for local docker socket

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-09-21 17:19:00 -07:00
parent 7497b116ea
commit eaa965127a
3 changed files with 27 additions and 3 deletions

View File

@ -57,6 +57,9 @@ import (
[string]: true @dagger(input) [string]: true @dagger(input)
} }
// Mount docker socket
socket?: dagger.#Stream @dagger(input)
// Additional packages to install // Additional packages to install
package: { package: {
[string]: true | false | string @dagger(input) [string]: true | false | string @dagger(input)
@ -213,6 +216,9 @@ import (
"/keyPassphrase": secret: ssh.keyPassphrase "/keyPassphrase": secret: ssh.keyPassphrase
} }
} }
if socket != _|_ {
"/var/run/docker.sock": stream: socket
}
for dest, o in mount { for dest, o in mount {
"\(dest)": o "\(dest)": o
} }

View File

@ -28,6 +28,9 @@ import (
keyPassphrase?: dagger.#Secret @dagger(input) keyPassphrase?: dagger.#Secret @dagger(input)
} }
// Mount local docker socket
socket?: dagger.#Stream & dagger.#Input
// Accept either a contaxt, a docker-compose or both together // Accept either a contaxt, a docker-compose or both together
source?: dagger.#Artifact @dagger(input) source?: dagger.#Artifact @dagger(input)
composeFile?: string @dagger(input) composeFile?: string @dagger(input)
@ -65,7 +68,13 @@ import (
"""# """#
run: docker.#Command & { run: docker.#Command & {
if ssh != _|_ {
"ssh": ssh "ssh": ssh
}
if socket != _|_ {
"socket": socket
}
command: #code command: #code
package: "docker-compose": true package: "docker-compose": true
"registries": registries "registries": registries

View File

@ -102,7 +102,7 @@ import (
#Run: { #Run: {
// Connect to a remote SSH server // Connect to a remote SSH server
ssh: { ssh?: {
// ssh host // ssh host
host: dagger.#Input & {string} host: dagger.#Input & {string}
@ -122,6 +122,9 @@ import (
keyPassphrase?: dagger.#Input & {dagger.#Secret} keyPassphrase?: dagger.#Input & {dagger.#Secret}
} }
// Mount local docker socket
socket?: dagger.#Stream & dagger.#Input
// Image reference (e.g: nginx:alpine) // Image reference (e.g: nginx:alpine)
ref: dagger.#Input & {string} ref: dagger.#Input & {string}
@ -147,7 +150,13 @@ import (
"""# """#
run: #Command & { run: #Command & {
if ssh != _|_ {
"ssh": ssh "ssh": ssh
}
if socket != _|_ {
"socket": socket
}
command: #command command: #command
env: { env: {
IMAGE_REF: ref IMAGE_REF: ref