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
Andrea Luzzardi 037dacaf6d example: deploy react to netlify
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-02-18 18:48:49 -08:00

69 lines
1.1 KiB
CUE

package simple
import (
"dagger.io/dagger"
)
let alpine = {
digest: "sha256:3c7497bf0c7af93428242d6176e8f7905f2201d8fc5861f45be7a346b5f23436"
package: [string]: true | false | string
#dagger: compute: [
{
do: "fetch-container"
ref: "index.docker.io/alpine@\(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"
},
]
}
}