2887139bf7
- 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>
51 lines
732 B
CUE
51 lines
732 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
|
|
command: {
|
|
args: [package]
|
|
flags: {
|
|
build: true
|
|
"-v": true
|
|
"-tags": tags
|
|
"-ldflags": ldflags
|
|
"-o": "/output/"
|
|
}
|
|
}
|
|
}
|
|
|
|
_binary: dagger.#Subdir & {
|
|
input: container.output.rootfs
|
|
path: "/output"
|
|
}
|
|
|
|
binary: _binary.output
|
|
}
|