This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/examples/jamstack/ecr_image.cue
Sam Alba ee555dea0c examples/jamstack: fixed logic to test the push-container with no-cache
Signed-off-by: Sam Alba <sam.alba@gmail.com>
2021-04-15 11:26:21 -07:00

46 lines
871 B
CUE

package main
import (
"dagger.io/dagger"
"dagger.io/dagger/op"
"dagger.io/aws"
"dagger.io/aws/ecr"
)
// Build an image and push it to ECR
#ECRImage: {
source: dagger.#Artifact
// Path of the Dockerfile
dockerfilePath?: string
repository: string
tag: string
awsConfig: aws.#Config
buildArgs: [string]: string
pushTarget: "\(repository):\(tag)"
// Use these credentials to push
ecrCreds: ecr.#Credentials & {
config: awsConfig
target: pushTarget
}
push: #up: [
// Build the docker image
op.#DockerBuild & {
context: source
if dockerfilePath != _|_ {
"dockerfilePath": dockerfilePath
}
buildArg: buildArgs
},
// Push the image to the registry
op.#PushContainer & {
ref: pushTarget
},
]
// FIXME: ref does not include the sha256: https://github.com/dagger/dagger/issues/303
ref: pushTarget
}