dc5d3340bb
universe.dagger.io/examples/todoapp on europa-docs-plan-tanguy-fresh-pair-of-eyes [$!?] via v17.4.0 ❯ bin/dagger do build 4:32PM FTL failed to execute plan: cyclic task dependency: task client.filesystem."./_build".write refers to task actions.build.contents._copy refers to task actions.build.run._exec refers to task actions.test._exec refers to task actions.deps._dag."2"._exec refers to task actions.deps._dag."1"._copy refers to task client.filesystem."./_build".write: /Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io/cue.mod/pkg/dagger.io/dagger/fs.cue:114:2 /Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io/docker/build.cue:49:2 /Users/gerhard/github.com/gerhard/dagger/pkg/universe.dagger.io/docker/run.cue:162:2 Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
106 lines
1.9 KiB
CUE
106 lines
1.9 KiB
CUE
package todoapp
|
|
|
|
import (
|
|
"dagger.io/dagger"
|
|
"universe.dagger.io/alpine"
|
|
"universe.dagger.io/bash"
|
|
"universe.dagger.io/docker"
|
|
"universe.dagger.io/netlify"
|
|
)
|
|
|
|
dagger.#Plan & {
|
|
_nodeModulesMount: "/src/node_modules": dagger.#Mount & {
|
|
dest: "/src/node_modules"
|
|
type: "cache"
|
|
contents: dagger.#CacheDir & {
|
|
id: "todoapp-modules-cache"
|
|
}
|
|
|
|
}
|
|
client: {
|
|
filesystem: {
|
|
"./": read: {
|
|
contents: dagger.#FS
|
|
exclude: [
|
|
"README.md",
|
|
"_build",
|
|
"todoapp.cue",
|
|
"node_modules",
|
|
]
|
|
}
|
|
"./_build": write: contents: actions.build.contents.output
|
|
}
|
|
env: {
|
|
APP_NAME: string
|
|
NETLIFY_TEAM: string
|
|
NETLIFY_TOKEN: dagger.#Secret
|
|
}
|
|
}
|
|
actions: {
|
|
deps: docker.#Build & {
|
|
steps: [
|
|
alpine.#Build & {
|
|
packages: {
|
|
bash: {}
|
|
yarn: {}
|
|
git: {}
|
|
}
|
|
},
|
|
docker.#Copy & {
|
|
contents: client.filesystem.".".read.contents
|
|
dest: "/src"
|
|
},
|
|
bash.#Run & {
|
|
workdir: "/src"
|
|
mounts: {
|
|
"/cache/yarn": dagger.#Mount & {
|
|
dest: "/cache/yarn"
|
|
type: "cache"
|
|
contents: dagger.#CacheDir & {
|
|
id: "todoapp-yarn-cache"
|
|
}
|
|
}
|
|
_nodeModulesMount
|
|
}
|
|
script: contents: #"""
|
|
yarn config set cache-folder /cache/yarn
|
|
yarn install
|
|
"""#
|
|
},
|
|
]
|
|
}
|
|
|
|
test: bash.#Run & {
|
|
input: deps.output
|
|
workdir: "/src"
|
|
mounts: _nodeModulesMount
|
|
script: contents: #"""
|
|
yarn run test
|
|
"""#
|
|
}
|
|
|
|
build: {
|
|
run: bash.#Run & {
|
|
input: test.output
|
|
mounts: _nodeModulesMount
|
|
workdir: "/src"
|
|
script: contents: #"""
|
|
yarn run build
|
|
"""#
|
|
}
|
|
|
|
contents: dagger.#Subdir & {
|
|
input: run.output.rootfs
|
|
path: "/src/build"
|
|
}
|
|
}
|
|
|
|
deploy: netlify.#Deploy & {
|
|
contents: build.contents.output
|
|
site: client.env.APP_NAME
|
|
token: client.env.NETLIFY_TOKEN
|
|
team: client.env.NETLIFY_TEAM
|
|
}
|
|
}
|
|
}
|