-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEarthfile
64 lines (57 loc) · 1.9 KB
/
Earthfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
VERSION 0.6
# renovate: datasource=docker depName=quay.io/kairos/osbuilder-tools versioning=semver-coerced
ARG OSBUILDER_VERSION=v0.400.3
ARG OSBUILDER_IMAGE=quay.io/kairos/osbuilder-tools:$OSBUILDER_VERSION
# renovate: datasource=docker depName=golangci/golangci-lint
ARG GOLINT_VERSION=v1.63.4
# renovate: datasource=docker depName=golang
ARG GO_VERSION=1.23-bookworm
version:
FROM +go-deps
COPY . ./
RUN --no-cache echo $(git describe --always --tags --dirty) > VERSION
RUN --no-cache echo $(git describe --always --dirty) > COMMIT
ARG VERSION=$(cat VERSION)
ARG COMMIT=$(cat COMMIT)
SAVE ARTIFACT VERSION VERSION
SAVE ARTIFACT COMMIT COMMIT
go-deps:
ARG GO_VERSION
FROM golang:$GO_VERSION
WORKDIR /build
COPY . .
RUN go mod tidy
RUN go mod download
RUN go mod verify
test:
FROM +go-deps
WORKDIR /build
RUN go run github.com/onsi/ginkgo/v2/ginkgo --race --covermode=atomic --coverprofile=coverage.out -p -r ./...
SAVE ARTIFACT coverage.out AS LOCAL coverage.out
golint:
ARG GOLINT_VERSION
FROM golangci/golangci-lint:$GOLINT_VERSION
WORKDIR /build
COPY . .
RUN go mod tidy
RUN golangci-lint run -v
build-immucore:
FROM +go-deps
COPY +version/VERSION ./
COPY +version/COMMIT ./
ARG VERSION=$(cat VERSION)
ARG COMMIT=$(cat COMMIT)
ARG LDFLAGS="-s -w -X github.com/kairos-io/immucore/internal/version.version=$VERSION -X github.com/kairos-io/immucore/internal/version.gitCommit=$COMMIT"
RUN echo ${LDFLAGS}
RUN CGO_ENABLED=0 go build -o immucore -ldflags "${LDFLAGS}"
SAVE ARTIFACT immucore immucore AS LOCAL build/immucore-$VERSION
# Alias for ease of use
build:
BUILD +build-immucore
dracut-artifacts:
FROM scratch
WORKDIR /build
COPY --dir dracut/28immucore .
COPY dracut/10-immucore.conf .
SAVE ARTIFACT 28immucore 28immucore
SAVE ARTIFACT 10-immucore.conf 10-immucore.conf