-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
81 lines (68 loc) · 1.83 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
VERSION 0.8
IMPORT github.com/formancehq/earthly:tags/v0.16.2 AS core
FROM core+base-image
sources:
WORKDIR src
WORKDIR /src
COPY go.* .
COPY --dir cmd internal .
COPY main.go .
SAVE ARTIFACT /src
compile:
FROM core+builder-image
COPY (+sources/*) /src
WORKDIR /src
ARG VERSION=latest
DO --pass-args core+GO_COMPILE --VERSION=$VERSION
build-image:
FROM core+final-image
ENTRYPOINT ["/bin/reconciliation"]
CMD ["serve"]
COPY (+compile/main) /bin/reconciliation
ARG REPOSITORY=ghcr.io
ARG tag=latest
DO core+SAVE_IMAGE --COMPONENT=reconciliation --REPOSITORY=${REPOSITORY} --TAG=$tag
tests:
FROM core+builder-image
COPY (+sources/*) /src
WORKDIR /src
WITH DOCKER --pull=postgres:15-alpine
DO --pass-args core+GO_TESTS
END
deploy:
COPY (+sources/*) /src
LET tag=$(tar cf - /src | sha1sum | awk '{print $1}')
WAIT
BUILD --pass-args +build-image --tag=$tag
END
FROM --pass-args core+vcluster-deployer-image
RUN kubectl patch Versions.formance.com default -p "{\"spec\":{\"reconciliation\": \"${tag}\"}}" --type=merge
deploy-staging:
BUILD --pass-args core+deploy-staging
lint:
FROM core+builder-image
COPY (+sources/*) /src
COPY --pass-args +tidy/go.* .
WORKDIR /src
DO --pass-args core+GO_LINT
SAVE ARTIFACT cmd AS LOCAL cmd
SAVE ARTIFACT internal AS LOCAL internal
SAVE ARTIFACT main.go AS LOCAL main.go
pre-commit:
WAIT
BUILD --pass-args +tidy
END
BUILD --pass-args +lint
openapi:
COPY ./openapi.yaml .
SAVE ARTIFACT ./openapi.yaml
tidy:
FROM core+builder-image
COPY --pass-args (+sources/src) /src
WORKDIR /src
DO --pass-args core+GO_TIDY
release:
FROM core+builder-image
ARG mode=local
COPY --dir . /src
DO core+GORELEASER --mode=$mode