293ee0680f
Signed-off-by: Tihomir Jovicic <tihomir.jovicic.develop@gmail.com>
50 lines
824 B
CUE
50 lines
824 B
CUE
package cloudrun
|
|
|
|
import (
|
|
"dagger.io/dagger/op"
|
|
"dagger.io/gcp"
|
|
)
|
|
|
|
// Service deploys a Cloud Run service based on provided GCR image
|
|
#Service: {
|
|
// GCP Config
|
|
config: gcp.#Config
|
|
|
|
// service name
|
|
name: string @dagger(input)
|
|
|
|
// GCR image ref
|
|
image: string @dagger(input)
|
|
|
|
// Cloud Run platform
|
|
platform: *"managed" | string @dagger(input)
|
|
|
|
#up: [
|
|
op.#Load & {
|
|
from: gcp.#GCloud & {
|
|
"config": config
|
|
}
|
|
},
|
|
|
|
op.#Exec & {
|
|
args: [
|
|
"/bin/bash",
|
|
"--noprofile",
|
|
"--norc",
|
|
"-eo",
|
|
"pipefail",
|
|
"-c",
|
|
#"""
|
|
gcloud run deploy "$SERVICE_NAME" --image "$IMAGE" --region "$REGION" --platform "$PLATFORM" --allow-unauthenticated
|
|
"""#,
|
|
]
|
|
env: {
|
|
SERVICE_NAME: name
|
|
PLATFORM: platform
|
|
REGION: config.region
|
|
IMAGE: image
|
|
}
|
|
},
|
|
]
|
|
}
|