This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/dev.cue
Solomon Hykes 299a38c6b1 Simplify "dev dagger with dagger" example
Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
2021-04-06 13:41:21 -07:00

56 lines
870 B
CUE

package main
import (
"dagger.io/dagger"
"dagger.io/alpine"
)
// Dagger source code
source: dagger.#Artifact
build: #Container & {
image: #ImageFromRef & {ref: "docker.io/golang:1.16-alpine"}
setup: [
"apk add --no-cache file",
]
volume: {
daggerSource: {
from: source
dest: "/src"
}
goCache: {
type: "cache"
dest: "/root/.cache/gocache"
}
}
// Add go to search path (FIXME: should be inherited from image metadata)
shell: search: "/usr/local/go/bin": true
env: {
GOMODCACHE: volume.goCache.dest
CGO_ENABLED: "0"
}
dir: "/src"
outputDir: "/binaries"
command: """
go test -v ./...
go build -o /binaries/ ./cmd/...
"""
}
usage: #Container & {
image: alpine.#Image
volume: binaries: {
from: build
dest: "/usr/local/dagger/bin/"
}
shell: search: "/usr/local/dagger/bin": true
command: "dagger help"
}