Merge pull request #129 from dagger/react-netlify
example: Deploy React app to Netlify
This commit is contained in:
commit
e4245e4090
28
examples/react-netlify/main.cue
Normal file
28
examples/react-netlify/main.cue
Normal file
@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/netlify"
|
||||
"dagger.io/yarn"
|
||||
)
|
||||
|
||||
repository: #dagger: compute: [
|
||||
dagger.#FetchGit & {
|
||||
remote: "https://github.com/kabirbaidhya/react-todo-app.git"
|
||||
ref: "624041b17bd62292143f99bce474a0e3c2d2dd61"
|
||||
},
|
||||
]
|
||||
|
||||
todoApp: netlify.#Site & {
|
||||
account: {
|
||||
name: "blocklayer"
|
||||
token: string // Fill using --input-string todoApp.account.token=XXX
|
||||
}
|
||||
|
||||
name: "dagger-test"
|
||||
|
||||
contents: yarn.#Script & {
|
||||
source: repository
|
||||
run: "build"
|
||||
}
|
||||
}
|
@ -1,6 +1,4 @@
|
||||
// ACME platform: everything you need to develop and ship improvements to
|
||||
// the ACME clothing store.
|
||||
package acme
|
||||
package simple
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
|
30
stdlib/alpine/alpine.cue
Normal file
30
stdlib/alpine/alpine.cue
Normal file
@ -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)"]
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
@ -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"]
|
||||
|
@ -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: [
|
||||
|
@ -13,6 +13,13 @@ DAGGER_BINARY_ARGS="${DAGGER_BINARY_ARGS:---log-format json}"
|
||||
read -ra DAGGER_BINARY_ARGS <<< "${DAGGER_BINARY_ARGS:-}"
|
||||
readonly DAGGER_BINARY_ARGS
|
||||
|
||||
test::examples() {
|
||||
local dagger="$1"
|
||||
|
||||
test::one "Examples: simple" --stdout='{"www":{"listing":"simple.cue\n","source":{}}}' \
|
||||
"$dagger" "${DAGGER_BINARY_ARGS[@]}" compute --input-dir www.source="$d"/../examples/simple "$d"/../examples/simple
|
||||
}
|
||||
|
||||
test::compute(){
|
||||
local dagger="$1"
|
||||
|
||||
@ -237,6 +244,8 @@ test::all(){
|
||||
test::export "$dagger"
|
||||
test::input "$dagger"
|
||||
test::subdir "$dagger"
|
||||
|
||||
test::examples "$dagger"
|
||||
}
|
||||
|
||||
case "${1:-all}" in
|
||||
|
Reference in New Issue
Block a user