First attempt at restoring the container.input interface

The goal is to preserve the container.input interface so that custom
images can be specified, as per yarn/test/test.cue while keeping the
initial fix for https://github.com/dagger/dagger/issues/1670

Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
This commit is contained in:
Gerhard Lazu 2022-03-03 12:39:32 +00:00
parent 089d464802
commit 26d24e6ac0
No known key found for this signature in database
GPG Key ID: A28DE70C9444D7A6
2 changed files with 26 additions and 24 deletions

View File

@ -66,7 +66,7 @@ dagger.#Plan & {
build: yarn.#Build & { build: yarn.#Build & {
source: common.data source: common.data
container: input: buildImage.output container: #input: buildImage.output
} }
} }
} }

View File

@ -18,26 +18,24 @@ import (
// Run a Yarn command // Run a Yarn command
#Run: { #Run: {
// Custom name for the build. // Custom name for this command.
// When building different apps in the same plan, assign // Assign an app-specific name if there are multiple apps in the same plan.
// different names for optimal caching.
name: string | *"" name: string | *""
// Application source code // App source code
source: dagger.#FS source: dagger.#FS
// working directory to use // Working directory to use
cwd: *"." | string cwd: *"." | string
// Write the contents of `environment` to this file, // Write the contents of `environment` to this file, in the "envfile" format
// in the "envfile" format
writeEnvFile: string | *"" writeEnvFile: string | *""
// Read build output from this directory // Optional: Read build output from this directory
// (path must be relative to working directory) // Must be relative to working directory, cwd
buildDir?: string buildDir?: string
// Run this yarn script // Yarn script to run for this command.
script: string script: string
// Fix for shadowing issues // Fix for shadowing issues
@ -50,18 +48,22 @@ import (
// FIXME: not implemented. Are they needed? // FIXME: not implemented. Are they needed?
secrets: [string]: dagger.#Secret secrets: [string]: dagger.#Secret
_build: docker.#Build & { container: #input: docker.#Image | *{
// FIXME: Yarn's version depends on Alpine's version
// Yarn version
// yarnVersion: *"=~1.22" | string
// FIXME: custom base image not supported
alpine.#Build & {
packages: {
bash: {}
yarn: {}
}
}
}
_run: docker.#Build & {
steps: [ steps: [
// FIXME: Yarn's version depends on Alpine's version container.#input,
// Yarn version
// yarnVersion: *"=~1.22" | string
// FIXME: custom base image not supported
alpine.#Build & {
packages: {
bash: {}
yarn: {}
}
},
docker.#Copy & { docker.#Copy & {
dest: "/src" dest: "/src"
@ -132,9 +134,9 @@ import (
] ]
} }
// The final contents of the package after build // The final contents of the package after run
_output: dagger.#Subdir & { _output: dagger.#Subdir & {
input: _build.output.rootfs input: _run.output.rootfs
path: "/build" path: "/build"
} }