diff --git a/stdlib/alpine/alpine.cue b/stdlib/alpine/alpine.cue new file mode 100644 index 00000000..83da22b1 --- /dev/null +++ b/stdlib/alpine/alpine.cue @@ -0,0 +1,30 @@ +package alpine + +import ( + "dagger.io/dagger" +) + +let defaultVersion = "3.13.2@sha256:a75afd8b57e7f34e4dad8d65e2c7ba2e1975c795ce1ee22fa34f8cf46f96a3be" + +#Image: { + package: [string]: true | false | string + version: string | *defaultVersion + + #dagger: compute: [ + dagger.#FetchContainer & { + ref: "index.docker.io/alpine:\(version)" + }, + for pkg, info in package { + if (info & true) != _|_ { + dagger.#Exec & { + args: ["apk", "add", "-U", "--no-cache", pkg] + } + } + if (info & string) != _|_ { + dagger.#Exec & { + args: ["apk", "add", "-U", "--no-cache", "\(pkg)\(info)"] + } + } + }, + ] +} diff --git a/stdlib/netlify/netlify.cue b/stdlib/netlify/netlify.cue index 513d1ab4..2e8ee494 100644 --- a/stdlib/netlify/netlify.cue +++ b/stdlib/netlify/netlify.cue @@ -1,6 +1,9 @@ package netlify -import "dagger.io/dagger" +import ( + "dagger.io/dagger" + "dagger.io/alpine" +) // A Netlify account #Account: { @@ -34,20 +37,13 @@ import "dagger.io/dagger" string #dagger: compute: [ - dagger.#FetchContainer & { - ref: "alpine@sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930" - }, - dagger.#Exec & { - args: ["apk", "add", "-U", "--no-cache", "bash=5.1.0-r0"] - }, - dagger.#Exec & { - args: ["apk", "add", "-U", "--no-cache", "jq=1.6-r1"] - }, - dagger.#Exec & { - args: ["apk", "add", "-U", "--no-cache", "curl=7.74.0-r0"] - }, - dagger.#Exec & { - args: ["apk", "add", "-U", "--no-cache", "yarn=1.22.10-r0"] + dagger.#Load & { + from: alpine.#Image & { + package: bash: "=5.1.0-r0" + package: jq: "=1.6-r1" + package: curl: "=7.74.0-r0" + package: yarn: "=1.22.10-r0" + } }, dagger.#Exec & { args: ["yarn", "global", "add", "netlify-cli@2.47.0"] diff --git a/stdlib/yarn/yarn.cue b/stdlib/yarn/yarn.cue index 2bf51222..bdb47acb 100644 --- a/stdlib/yarn/yarn.cue +++ b/stdlib/yarn/yarn.cue @@ -2,6 +2,7 @@ package yarn import ( "dagger.io/dagger" + "dagger.io/alpine" ) // Yarn Script @@ -20,14 +21,11 @@ import ( env?: [string]: string #dagger: compute: [ - dagger.#FetchContainer & { - ref: "alpine@sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930" - }, - dagger.#Exec & { - args: ["apk", "add", "-U", "--no-cache", "bash=5.1.0-r0"] - }, - dagger.#Exec & { - args: ["apk", "add", "-U", "--no-cache", "yarn=1.22.10-r0"] + dagger.#Load & { + from: alpine.#Image & { + package: bash: "=5.1.0-r0" + package: yarn: "=1.22.10-r0" + } }, dagger.#Exec & { args: [