Add dagger golang use case

Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2022-03-15 14:32:26 +01:00
committed by Vasek - Tom C
parent 21c6af0678
commit 2d3acc61e0
5 changed files with 205 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package main
import (
"dagger.io/dagger"
"universe.dagger.io/go"
)
dagger.#Plan & {
client: {
// Retrieve go source code
filesystem: ".": read: {
contents: dagger.#FS
include: ["go.mod", "go.sum", "**/*.go"]
}
}
actions: {
// Alias to code directory
_code: client.filesystem.".".read.contents
// Improved go base image with useful tool
// Enable cgo by installing build-base
_base: go.#Image & {
packages: "build-base": version: _
}
// Build go project
build: go.#Build & {
source: _code
}
}
}