ci: cleaner pattern for sharing base images across actions

Signed-off-by: Sam Alba <samalba@users.noreply.github.com>
This commit is contained in:
Sam Alba
2022-02-17 11:58:31 -08:00
parent f17c470feb
commit 8e2f3eb21d
2 changed files with 11 additions and 7 deletions

47
ci/images.cue Normal file
View File

@@ -0,0 +1,47 @@
package main
import (
"universe.dagger.io/docker"
)
let GoVersion = "1.17"
let GolangCILintVersion = "1.44.0"
// Base container images used for the CI
#Images: {
// base image to build go binaries
goBuilder: _goBuilder.output
_goBuilder: docker.#Build & {
_packages: ["bash", "git"]
steps: [
docker.#Pull & {
source: "index.docker.io/golang:\(GoVersion)-alpine"
},
for pkg in _packages {
docker.#Run & {
command: {
name: "apk"
args: ["add", pkg]
flags: {
"-U": true
"--no-cache": true
}
}
}
},
]
}
// base image for the Go linter
// https://golangci-lint.run/usage/install/#docker
goLinter: _goLinter.output
_goLinter: docker.#Build & {
steps: [
docker.#Pull & {
source: "index.docker.io/golangci/golangci-lint:v\(GolangCILintVersion)"
},
]
}
}