This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/examples/simple/simple.cue
Solomon Hykes fa2cfc1267 Fix examples/simple (cannot load across package imports)
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-01-30 00:25:58 -08:00

73 lines
1.2 KiB
CUE

// ACME platform: everything you need to develop and ship improvements to
// the ACME clothing store.
package acme
import (
"dagger.cloud/dagger"
)
let alpine={
digest: "sha256:3c7497bf0c7af93428242d6176e8f7905f2201d8fc5861f45be7a346b5f23436"
package: [string]: true | false | string
#dagger: compute: [
{
do: "fetch-container"
ref: "index.docker.io@\(digest)"
},
for pkg, info in package {
if (info & true) != _|_ {
do: "exec"
args: ["apk", "add", "-U", "--no-cache", pkg]
}
if (info & string) != _|_ {
do: "exec"
args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"]
}
},
]
}
www: {
source: dagger.#Dir
// List the contents of the source directory
listing: {
string
#dagger: compute: [
dagger.#Load & {
from: alpine
},
dagger.#Exec & {
args: ["sh", "-c", "ls /src > /tmp/out"]
mount: "/src": {
from: source
}
},
dagger.#Export & {
source: "/tmp/out"
}
]
}
host: string
url: {
string
#dagger: compute: [
{
do: "load"
from: alpine
},
dagger.#Exec & {
args: ["sh", "-c", "echo -n 'https://\(host)/foo' > /tmp/out"]
},
dagger.#Export & {
source: "/tmp/out"
},
]
}
}