universe: go: improve cache management
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
@@ -18,25 +18,31 @@ import (
|
||||
// Use go image
|
||||
_image: #Image
|
||||
|
||||
_sourcePath: "/src"
|
||||
_cachePath: "/root/.cache/gocache"
|
||||
_sourcePath: "/src"
|
||||
_modCachePath: "/root/.cache/go-mod"
|
||||
_buildCachePath: "/root/.cache/go-build"
|
||||
|
||||
docker.#Run & {
|
||||
input: *_image.output | docker.#Image
|
||||
workdir: "/src"
|
||||
command: name: "go"
|
||||
workdir: _sourcePath
|
||||
mounts: {
|
||||
"source": {
|
||||
dest: _sourcePath
|
||||
contents: source
|
||||
}
|
||||
"go assets cache": {
|
||||
"go mod cache": {
|
||||
contents: core.#CacheDir & {
|
||||
id: "\(name)_assets"
|
||||
id: "\(name)_mod"
|
||||
}
|
||||
dest: _cachePath
|
||||
dest: _modCachePath
|
||||
}
|
||||
"go build cache": {
|
||||
contents: core.#CacheDir & {
|
||||
id: "\(name)_build"
|
||||
}
|
||||
dest: _buildCachePath
|
||||
}
|
||||
}
|
||||
env: GOMODCACHE: _cachePath
|
||||
env: GOMODCACHE: _modCachePath
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user