1e384c4e9a
- 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>
51 lines
754 B
CUE
51 lines
754 B
CUE
package go
|
|
|
|
import (
|
|
"dagger.io/dagger"
|
|
)
|
|
|
|
// Build a go binary
|
|
#Build: {
|
|
// Source code
|
|
source: dagger.#FS
|
|
|
|
// Target package to build
|
|
package: *"." | string
|
|
|
|
// Target architecture
|
|
arch: *"amd64" | string
|
|
|
|
// Target OS
|
|
os: *"linux" | string
|
|
|
|
// Build tags to use for building
|
|
tags: *"" | string
|
|
|
|
// LDFLAGS to use for linking
|
|
ldflags: *"" | string
|
|
|
|
env: [string]: string
|
|
|
|
container: #Container & {
|
|
"source": source
|
|
"env": {
|
|
env
|
|
GOOS: os
|
|
GOARCH: arch
|
|
}
|
|
command: {
|
|
args: [package]
|
|
flags: {
|
|
build: true
|
|
"-v": true
|
|
"-tags": tags
|
|
"-ldflags": ldflags
|
|
"-o": "/output/"
|
|
}
|
|
}
|
|
export: directories: "/output/": _
|
|
}
|
|
|
|
binary: container.export.directories."/output/".contents
|
|
}
|