examples: added outputs/inputs annotations

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-06-01 16:00:01 +02:00
parent 2bd4679646
commit 56e60c5b29
7 changed files with 49 additions and 37 deletions

View File

@ -9,40 +9,46 @@ import (
// Backend configuration
backend: {
// Source code to build this container
source: git.#Repository | dagger.#Artifact
source: git.#Repository | dagger.#Artifact @dagger(input)
// Container environment variables
environment: [string]: string
environment: {
[string]: string @dagger(input)
}
// Public hostname (need to match the master domain configures on the loadbalancer)
hostname: string
hostname: string @dagger(input)
// Container configuration
container: {
// Desired number of running containers
desiredCount: *1 | int
desiredCount: *1 | int @dagger(input)
// Time to wait for the HTTP timeout to complete
healthCheckTimeout: *10 | int
healthCheckTimeout: *10 | int @dagger(input)
// HTTP Path to perform the healthcheck request (HTTP Get)
healthCheckPath: *"/" | string
healthCheckPath: *"/" | string @dagger(input)
// Number of times the health check needs to fail before recycling the container
healthCheckUnhealthyThreshold: *2 | int
healthCheckUnhealthyThreshold: *2 | int @dagger(input)
// Port used by the process inside the container
port: *80 | int
port: *80 | int @dagger(input)
// Memory to allocate
memory: *1024 | int
memory: *1024 | int @dagger(input)
// Override the default container command
command: [...string]
command: [...string] @dagger(input)
// Custom dockerfile path
dockerfilePath: *"" | string
dockerfilePath: *"" | string @dagger(input)
// docker build args
dockerBuildArgs: [string]: string
dockerBuildArgs: {
[string]: string @dagger(input)
}
}
// Init container runs only once when the main container starts
initContainer: {
command: [...string]
environment: [string]: string
command: [...string] @dagger(input)
environment: {
[string]: string @dagger(input)
}
}
}

View File

@ -7,7 +7,7 @@ import (
database: {
let slug = name
dbType: "mysql" | "postgresql"
dbType: "mysql" | "postgresql" @dagger(input)
db: rds.#CreateDB & {
config: infra.awsConfig

View File

@ -9,24 +9,30 @@ import (
frontend: {
// Source code to build the app
source: git.#Repository | dagger.#Artifact
source: git.#Repository | dagger.#Artifact @dagger(input)
writeEnvFile?: string
writeEnvFile?: string @dagger(input)
// Yarn Build
yarn: {
// Run this yarn script
script: string | *"build"
script: string | *"build" @dagger(input)
// Read build output from this directory
// (path must be relative to working directory).
buildDir: string | *"build"
buildDir: string | *"build" @dagger(input)
}
// Build environment variables
environment: [string]: string
environment: NODE_ENV: string | *"production"
environment: APP_URL: "https://\(name).netlify.app/"
environment: {
[string]: string @dagger(input)
}
environment: {
NODE_ENV: string | *"production" @dagger(input)
}
environment: {
APP_URL: "https://\(name).netlify.app/" @dagger(input)
}
}
frontend: {

View File

@ -10,26 +10,26 @@ infra: {
awsConfig: aws.#Config
// VPC Id
vpcId: string
vpcId: string @dagger(input)
// ECR Image repository
ecrRepository: string
ecrRepository: string @dagger(input)
// ECS cluster name
ecsClusterName: string
ecsClusterName: string @dagger(input)
// Execution Role ARN used for all tasks running on the cluster
ecsTaskRoleArn?: string
ecsTaskRoleArn?: string @dagger(input)
// ELB listener ARN
elbListenerArn: string
elbListenerArn: string @dagger(input)
// Secret ARN for the admin password of the RDS Instance
rdsAdminSecretArn: string
rdsAdminSecretArn: string @dagger(input)
// ARN of the RDS Instance
rdsInstanceArn: string
rdsInstanceArn: string @dagger(input)
// Netlify credentials
netlifyAccount: netlify.#Account
netlifyAccount: netlify.#Account @dagger(input)
}

View File

@ -1,7 +1,7 @@
package main
// Name of the application
name: string & =~"[a-z0-9-]+"
name: string & =~"[a-z0-9-]+" @dagger(input)
// Inject db info in the container environment
backend: environment: {
@ -17,6 +17,6 @@ backend: environment: {
frontend: environment: APP_URL_API: url.backendURL
url: {
frontendURL: frontend.site.url
backendURL: "https://\(backend.hostname)/"
frontendURL: frontend.site.url @dagger(output)
backendURL: "https://\(backend.hostname)/" @dagger(output)
}

View File

@ -6,14 +6,14 @@ import (
// AWS account: credentials and region
awsConfig: aws.#Config & {
region: *"us-east-1" | string
region: *"us-east-1" | string @dagger(input)
}
// URL of the website to monitor
website: string | *"https://www.google.com"
website: string | *"https://www.google.com" @dagger(input)
// Email address to notify of monitoring alerts
email: string
email: string @dagger(input)
// The monitoring service running on AWS Cloudwatch
monitor: #HTTPMonitor & {

View File

@ -15,7 +15,7 @@ repo: git.#Repository & {
// Host the application with Netlify
www: netlify.#Site & {
// Site name can be overridden
name: string | *"dagger-examples-react"
name: string | *"dagger-examples-react" @dagger(input)
// Deploy the output of yarn build
// (Netlify build feature is not used, to avoid extra cost).