Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones 2021-10-05 12:04:10 -06:00
parent 35a86441bf
commit 4c7d90f9bc
2 changed files with 26 additions and 26 deletions

View File

@ -1,19 +1,19 @@
package todoapp package todoapp
import ( import (
"alpha.dagger.io/dagger" "alpha.dagger.io/dagger"
"alpha.dagger.io/docker" "alpha.dagger.io/docker"
) )
// run our todoapp in our local Docker engine // run our todoapp in our local Docker engine
run: docker.#Run & { run: docker.#Run & {
ref: push.ref ref: push.ref
name: "todoapp" name: "todoapp"
ports: ["8080:80"] ports: ["8080:80"]
socket: dagger.#Stream & dagger.#Input socket: dagger.#Stream & dagger.#Input
} }
// push to our local registry // push to our local registry
// this concrete value satisfies the string constraint // this concrete value satisfies the string constraint
// we defined in the previous file // we defined in the previous file
push: target: "localhost:5000/todoapp" push: target: "localhost:5000/todoapp"

View File

@ -1,36 +1,36 @@
package todoapp package todoapp
import ( import (
"alpha.dagger.io/dagger" "alpha.dagger.io/dagger"
"alpha.dagger.io/os" "alpha.dagger.io/os"
"alpha.dagger.io/docker" "alpha.dagger.io/docker"
"alpha.dagger.io/js/yarn" "alpha.dagger.io/js/yarn"
) )
// Build the source code using Yarn // Build the source code using Yarn
app: yarn.#Package & { app: yarn.#Package & {
"source": dagger.#Artifact & dagger.#Input "source": dagger.#Artifact & dagger.#Input
} }
// package the static HTML from yarn into a Docker image // package the static HTML from yarn into a Docker image
image: os.#Container & { image: os.#Container & {
image: docker.#Pull & { image: docker.#Pull & {
from: "nginx" from: "nginx"
} }
// app.build references our app key above // app.build references our app key above
// which infers a dependency that Dagger // which infers a dependency that Dagger
// uses to generate the DAG // uses to generate the DAG
copy: "/usr/share/nginx/html": from: app.build copy: "/usr/share/nginx/html": from: app.build
} }
// push the image to a registry // push the image to a registry
push: docker.#Push & { push: docker.#Push & {
// leave target blank here so that different // leave target blank here so that different
// environments can push to different registries // environments can push to different registries
target: string target: string
// the source of our push resource // the source of our push resource
// is the image resource we declared above // is the image resource we declared above
source: image source: image
} }