Apply Solomon comments

- Simplify cache id parameter with a field `name`
- Configure GOOS & GOARCH values
- Container image can now be overridden
- Simplify build export

Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2022-02-18 15:12:58 +01:00
committed by Vasek - Tom C
parent 2887139bf7
commit 1e384c4e9a
3 changed files with 25 additions and 19 deletions

View File

@@ -8,27 +8,20 @@ import (
// A standalone go environment to run go command
#Container: {
// Go version to use
version: *#DefaultVersion | string
// Container app name
name: *"go_builder" | string
// Source code
source: dagger.#FS
// Configure caching
cache: {
id: *"go_build" | string
}
// Use go image
_image: #Image & {
"version": version
}
_image: #Image
_sourcePath: "/src"
_cachePath: "/root/.cache/gocache"
docker.#Run & {
input: _image.output
input: *_image.output | docker.#Image
workdir: "/src"
command: name: "go"
mounts: {
@@ -38,7 +31,7 @@ import (
}
"go assets cache": {
contents: dagger.#CacheDir & {
id: "\(cache.id)_assets"
id: "\(name)_assets"
}
dest: _cachePath
}