embedded stdlib

This PR embeds the stdlib into the dagger binary itself for convenience.
Long term we will want to source the stdlib directly from git.

- Updated go to 1.16 to use the new built-in embedding functionality
- The `stdlib` go package now contains an embed of the stdlib

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-02-16 17:54:43 -08:00
parent 31f1cd9f1d
commit 5ba6dd1617
13 changed files with 85 additions and 108 deletions

64
stdlib/yarn/yarn.cue Normal file
View File

@@ -0,0 +1,64 @@
package yarn
import (
"dagger.cloud/dagger"
)
// Yarn Script
#Script: {
// Source code of the javascript application
source: dagger.#Dir
// 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
#dagger: compute: [
dagger.#FetchContainer & {
ref: "alpine@sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930"
},
dagger.#Exec & {
args: ["apk", "add", "-U", "--no-cache", "bash=5.1.0-r0"]
},
dagger.#Exec & {
args: ["apk", "add", "-U", "--no-cache", "yarn=1.22.10-r0"]
},
dagger.#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"
}
},
dagger.#Subdir & {
dir: "/build"
},
]
}