Europa: integrate core packages, separate universe
Signed-off-by: Solomon Hykes <solomon@dagger.io>
This commit is contained in:
3
europa-universe/examples/README.md
Normal file
3
europa-universe/examples/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## Dagger examples
|
||||
|
||||
A collection of examples to help Dagger developers get started.
|
28
europa-universe/examples/todoapp/base.cue
Normal file
28
europa-universe/examples/todoapp/base.cue
Normal file
@@ -0,0 +1,28 @@
|
||||
// Deployment plan for Dagger's example todoapp
|
||||
package todoapp
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
|
||||
"universe.dagger.io/git"
|
||||
"universe.dagger.io/yarn"
|
||||
)
|
||||
|
||||
dagger.#DAG & {
|
||||
// Build the app with yarn
|
||||
actions: build: yarn.#Build
|
||||
|
||||
// Wire up source code to build
|
||||
{
|
||||
input: directories: source: _
|
||||
actions: build: source: input.directories.source.contents
|
||||
} | {
|
||||
actions: {
|
||||
pull: git.#Pull & {
|
||||
remote: "https://github.com/mdn/todo-react"
|
||||
ref: "master"
|
||||
}
|
||||
build: source: pull.checkout
|
||||
}
|
||||
}
|
||||
}
|
40
europa-universe/examples/todoapp/dev/dev.cue
Normal file
40
europa-universe/examples/todoapp/dev/dev.cue
Normal file
@@ -0,0 +1,40 @@
|
||||
// Local dev environment for todoapp
|
||||
package todoapp
|
||||
|
||||
import (
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/nginx"
|
||||
)
|
||||
|
||||
// Expose todoapp web port
|
||||
proxy: web: _
|
||||
|
||||
actions: {
|
||||
// Reference app build inherited from base config
|
||||
build: _
|
||||
_app: build.output
|
||||
|
||||
container: {
|
||||
// Build a container image serving the app with nginx
|
||||
build: docker.#Build & {
|
||||
steps: [
|
||||
nginx.#Build & {
|
||||
flavor: "alpine"
|
||||
},
|
||||
docker.#Copy & {
|
||||
contents: _app
|
||||
dest: "/usr/share/nginx/html"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
// Run the app in an ephemeral container
|
||||
run: docker.#Run & {
|
||||
image: build.output
|
||||
ports: web: {
|
||||
frontend: proxy.web.endpoint
|
||||
backend: address: "localhost:5000"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
europa-universe/examples/todoapp/staging/staging.cue
Normal file
25
europa-universe/examples/todoapp/staging/staging.cue
Normal file
@@ -0,0 +1,25 @@
|
||||
// Deploy to Netlify
|
||||
package todoapp
|
||||
|
||||
import (
|
||||
"universe.dagger.io/netlify"
|
||||
)
|
||||
|
||||
// Netlify API token
|
||||
input: secrets: netlify: _
|
||||
|
||||
// Must be a valid branch/PR name
|
||||
environment: string
|
||||
|
||||
actions: {
|
||||
|
||||
// Yarn build inherited from base config
|
||||
build: _
|
||||
|
||||
deploy: netlify.#Deploy & {
|
||||
contents: build.output
|
||||
token: input.secrets.netlify.contents
|
||||
site: *"acme-inc-\(environment)" | string
|
||||
team: *"acme-inc" | string
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user