Signed-off-by: Joel Longtine <joel@dagger.io>
This commit is contained in:
Joel Longtine
2022-03-10 15:15:50 -07:00
parent b3ac2b7167
commit 43b9df74a8
3 changed files with 72 additions and 1 deletions

View File

@@ -0,0 +1,60 @@
package main
import (
"alpha.dagger.io/dagger"
"alpha.dagger.io/aws/s3"
"alpha.dagger.io/netlify"
"alpha.dagger.io/os"
)
repo: dagger.#Artifact & dagger.#Input
hello: {
dir: dagger.#Artifact & dagger.#Input
ctr: os.#Container & {
command: """
ls -l /src > /tmp/out
"""
mount: "/src": from: dir
}
f: os.#File & {
from: ctr
path: "/tmp/out"
}
message: f.contents & dagger.#Output
}
// Website
web: {
source: os.#Dir & {
from: repo
path: "web"
}
url: string & dagger.#Output
// Where to host the website?
provider: *"s3" | "netlify" & dagger.#Input
// Deploy to AWS S3
if provider == "s3" {
url: "\(bucket.url)index.html"
bucket: s3.#Put & {
contentType: "text/html"
"source": source
}
}
// Deploy to Netlify
if provider == "netlify" {
url: site.url
site: netlify.#Site & {
contents: source
}
}
}