stdlib: dagger.io/go.#Container

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
Solomon Hykes 2021-05-01 01:04:49 +00:00
parent 256311d0ad
commit 3353579dbb

View File

@ -3,8 +3,42 @@ package go
import ( import (
"dagger.io/dagger" "dagger.io/dagger"
"dagger.io/dagger/op" "dagger.io/dagger/op"
"dagger.io/docker"
) )
// A standalone go environment
#Container: {
// Go version to use
version: *"1.16" | string
source: dagger.#Artifact
docker.#Container & {
env: {
GOMODCACHE: volume.goCache.dest
CGO_ENABLED: "0"
}
image: docker.#ImageFromRegistry & {
ref: "docker.io/golang:\(version)-alpine"
}
volume: {
goSource: {
from: source
dest: "/src"
}
goCache: {
type: "cache"
dest: "/root/.cache/gocache"
}
}
dir: volume.goSource.dest
// Add go to search path (FIXME: should be inherited from image metadata)
shell: search: "/usr/local/go/bin": true
}
}
#Go: { #Go: {
// Go version to use // Go version to use
version: *"1.16" | string version: *"1.16" | string