Skip to content

Instantly share code, notes, and snippets.

@jpadams
Created June 29, 2022 01:07
Show Gist options
  • Save jpadams/66855aec44a87654b73d44367ba69bb9 to your computer and use it in GitHub Desktop.
Save jpadams/66855aec44a87654b73d44367ba69bb9 to your computer and use it in GitHub Desktop.
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/bash"
"universe.dagger.io/docker"
)
_workdir: "/usr/app"
dagger.#Plan & {
actions: {
build: {
checkoutCode: core.#Source & {
path: "."
}
run: docker.#Build & {
steps: [
docker.#Pull & {
source: "node:lts"
},
docker.#Copy & {
contents: checkoutCode.output
dest: _workdir
},
docker.#Set & {
config: workdir: _workdir
},
bash.#Run & {
script: contents: """
yarn install
"""
},
bash.#Run & {
always: true
script: contents: """
yarn run build
yarn run test
"""
},
]
}
}
}
}
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/bash"
"universe.dagger.io/docker"
)
_workdir: "/usr/app"
dagger.#Plan & {
actions: {
build: {
checkoutCode: core.#Source & {
path: "."
}
pull: docker.#Pull & {
source: "node:lts"
}
copy: docker.#Copy & {
input: pull.output
contents: checkoutCode.output
dest: _workdir
}
set: docker.#Set & {
input: copy.output
config: workdir: _workdir
}
install: bash.#Run & {
input: set.output
script: contents: """
yarn install
"""
}
run: bash.#Run & {
input: install.output
always: true
script: contents: """
yarn run build
yarn run test
"""
}
}
}
}
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/core"
"universe.dagger.io/yarn"
)
dagger.#Plan & {
actions: {
build: {
checkoutCode: core.#Source & {
path: "."
}
build: yarn.#Build & {
source: checkoutCode.output
}
test: yarn.#Script & {
source: checkoutCode.output
name: "test"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment