Universe: yarn: leverage alpine packages for using base image

Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
This commit is contained in:
Sam Alba 2022-01-19 09:50:06 -08:00
parent c3f0800c56
commit 9650940dd5

View File

@ -7,8 +7,7 @@ import (
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/dagger/engine" "dagger.io/dagger/engine"
// "universe.dagger.io/alpine" "universe.dagger.io/alpine"
"universe.dagger.io/docker"
"universe.dagger.io/bash" "universe.dagger.io/bash"
) )
@ -34,7 +33,7 @@ import (
// Fix for shadowing issues // Fix for shadowing issues
let yarnScript = script let yarnScript = script
// FIXME: `CacheDir` must be passed by the caller? // Cache to use, passed by the caller
cache: engine.#CacheDir cache: engine.#CacheDir
// Optional arguments for the script // Optional arguments for the script
@ -44,18 +43,13 @@ import (
// FIXME: not implemented. Are they needed? // FIXME: not implemented. Are they needed?
secrets: [string]: dagger.#Secret secrets: [string]: dagger.#Secret
// FIXME: Yarn's version depends on Alpine's version
// Yarn version // Yarn version
yarnVersion: *"=~1.22" | string // yarnVersion: *"=~1.22" | string
// FIXME: trouble getting docker.#Build to work (cueflow task dependencies not working) // FIXME: trouble getting docker.#Build to work (cueflow task dependencies not working)
alpine: docker.#Pull & { image: alpine.#Build & {
source: "index.docker.io/alpine:3.13.5@sha256:69e70a79f2d41ab5d637de98c1e0b055206ba40a8145e7bddb55ccc04e13cf8f" packages: "bash": {}
}
yarnImage: docker.#Run & {
image: alpine.image
script: """
apk add -U --no-cache bash yarn
"""
} }
// Run yarn in a containerized build environment // Run yarn in a containerized build environment
@ -75,7 +69,7 @@ import (
// env: CUSTOM_IMAGE: "1" // env: CUSTOM_IMAGE: "1"
// } // }
image: docker.#Image & yarnImage.output "image": image.output
script: #""" script: #"""
# Create $ENVFILE_NAME file if set # Create $ENVFILE_NAME file if set