stdlib: docker: support running containers on the local docker engine

Depends on #570

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-06-04 16:57:31 -07:00
parent 4365541d4d
commit ce5accd09c
23 changed files with 325 additions and 181 deletions

View File

@@ -0,0 +1,33 @@
package docker
import (
"strconv"
"dagger.io/alpine"
"dagger.io/dagger/op"
)
#Random: {
size: *12 | number
out: {
string
#up: [
op.#Load & {from: alpine.#Image},
op.#Exec & {
always: true
args: ["sh", "-c", #"""
tr -cd '[:alpha:]' < /dev/urandom | fold -w "$SIZE" | head -n 1 | tr '[A-Z]' '[a-z]' | tr -d '\n' > /rand
"""#,
]
env: SIZE: strconv.FormatInt(size, 10)
},
op.#Export & {
source: "/rand"
},
]
}
}

View File

@@ -0,0 +1,29 @@
package docker
import (
"dagger.io/docker"
"dagger.io/dagger"
)
testConfig: {
host: string @dagger(input)
user: string @dagger(input)
key: dagger.#Secret @dagger(input)
}
key: dagger.#Secret @dagger(input)
TestSSH: {
random: #Random & {}
run: docker.#Run & {
name: "daggerci-test-simple-\(random.out)"
ref: "hello-world"
ssh: {
host: testConfig.host
user: testConfig.user
key: testConfig.key
}
}
}