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/stdlib/yarn/yarn.cue
Andrea Luzzardi c16455249e cue files: #compute -> #up
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-04-02 16:08:15 -07:00

64 lines
1.1 KiB
CUE

package yarn
import (
"dagger.io/dagger"
"dagger.io/alpine"
"dagger.io/llb"
)
// Yarn Script
#Script: {
// Source code of the javascript application
source: dagger.#Artifact
// Run this yarn script
run: string | *"build"
// Read build output from this directory
// (path must be relative to working directory).
buildDirectory: string | *"build"
// Set these environment variables during the build
env?: [string]: string
#up: [
llb.#Load & {
from: alpine.#Image & {
package: bash: "=~5.1"
package: yarn: "=~1.22"
}
},
llb.#Exec & {
args: [
"/bin/bash",
"--noprofile",
"--norc",
"-eo",
"pipefail",
"-c",
"""
yarn install --production false
yarn run "$YARN_BUILD_SCRIPT"
mv "$YARN_BUILD_DIRECTORY" /build
""",
]
if env != _|_ {
"env": env
}
"env": {
YARN_BUILD_SCRIPT: run
YARN_CACHE_FOLDER: "/cache/yarn"
YARN_BUILD_DIRECTORY: buildDirectory
}
dir: "/src"
mount: {
"/src": from: source
"/cache/yarn": "cache"
}
},
llb.#Subdir & {
dir: "/build"
},
]
}