Apply Solomon comments on universe.dagger.io/go
- Improve #Container with a better docker.#Run integration - Supports concurrency caching in #Container - Simplify code maintainability and readability - Simplify binary export in #Build - Support multi binary building - External #Version management Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
committed by
Vasek - Tom C
parent
e49bb34e87
commit
2887139bf7
@@ -3,20 +3,21 @@ package go
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/engine"
|
||||
"universe.dagger.io/docker"
|
||||
)
|
||||
|
||||
// A standalone go environment to run go command
|
||||
#Container: {
|
||||
// Go version to use
|
||||
version: *#Image.version | string
|
||||
version: *#DefaultVersion | string
|
||||
|
||||
// Source code
|
||||
source: dagger.#FS
|
||||
|
||||
// Arguments
|
||||
args: [...string]
|
||||
// Configure caching
|
||||
cache: {
|
||||
id: *"go_build" | string
|
||||
}
|
||||
|
||||
// Use go image
|
||||
_image: #Image & {
|
||||
@@ -29,18 +30,15 @@ import (
|
||||
docker.#Run & {
|
||||
input: _image.output
|
||||
workdir: "/src"
|
||||
command: {
|
||||
name: "go"
|
||||
"args": args
|
||||
}
|
||||
command: name: "go"
|
||||
mounts: {
|
||||
"source": {
|
||||
dest: _sourcePath
|
||||
contents: source
|
||||
}
|
||||
"go assets cache": {
|
||||
contents: engine.#CacheDir & {
|
||||
id: "\(_cachePath)_assets"
|
||||
contents: dagger.#CacheDir & {
|
||||
id: "\(cache.id)_assets"
|
||||
}
|
||||
dest: _cachePath
|
||||
}
|
||||
|
Reference in New Issue
Block a user