This commit is contained in:
2022-04-19 22:45:36 +02:00
parent 9ddbc60a3b
commit f496357522
9 changed files with 218 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
[package]
name = "hello_world"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}

View File

@@ -0,0 +1,40 @@
package rust
import (
"dagger.io/dagger"
"universe.dagger.io/x/contact@kjuulh.io/rust"
"universe.dagger.io/docker"
)
dagger.#Plan & {
actions: test: {
_source: dagger.#Scratch & {}
simple: {
_image: rust.#Image & {}
verify: docker.#Run & {
input: _image.output
command: {
name: "/bin/sh"
args: ["-c", "cargo version | grep '1.6'"]
}
}
}
custom: {
_image: rust.#Image & {
version: "1.56"
}
verify: docker.#Run & {
input: _image.output
command: {
name: "/bin/sh"
args: ["-c", "cargo version | grep '1.56'"]
}
}
}
}
}

View File

@@ -0,0 +1,58 @@
package rust
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/x/contact@kjuulh.io/rust"
"universe.dagger.io/docker"
"universe.dagger.io/alpine"
)
dagger.#Plan & {
client: filesystem: "./data/hello_world": read: contents: dagger.#FS
actions: test: {
_baseImage: {
build: alpine.#Build & {
packages: {
"ca-certificates": {}
"krb5-libs": {}
libgcc: {}
libintl: {}
"libssl1.1": {}
"libstdc++": {}
zlib: {}
}
}
output: build.output
}
simple: {
publish: rust.#Publish & {
source: client.filesystem."./data".read.contents
package: "hello"
}
exec: docker.#Run & {
input: _baseImage.output
command: {
name: "/bin/sh"
args: ["-c", "/app/hello_world >> /output.txt"]
}
env: NAME: "dagger"
mounts: binary: {
dest: "/app"
contents: publish.output
source: "/"
}
}
verify: core.#ReadFile & {
input: exec.output.rootfs
path: "/output.txt"
} & {
contents: "Hi dagger!"
}
}
}
}

View File

@@ -0,0 +1,10 @@
setup() {
load '../../../../bats_helpers'
common_setup
}
@test "rust" {
dagger "do" -p ./publish.cue test
dagger "do" -p ./image.cue test
}