stdlib: dagger.io/go.#Container
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
parent
256311d0ad
commit
3353579dbb
@ -3,8 +3,42 @@ package go
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"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 version to use
|
||||
version: *"1.16" | string
|
||||
|
Reference in New Issue
Block a user