-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
105 lines (75 loc) · 1.94 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
VERSION 0.8
FROM tochemey/docker-go:1.23.2-5.0.0
all:
BUILD +protogen
code:
WORKDIR /app
# download deps
COPY go.mod go.sum ./
RUN go mod download -x
# copy in code
COPY --dir . ./
vendor:
FROM +code
RUN go mod tidy && go mod vendor
SAVE ARTIFACT /app /files
protogen:
# copy the proto files to generate
COPY --dir protos/ ./
COPY buf.yaml buf.gen.yaml ./
# generate the pbs
RUN buf generate \
--template buf.gen.yaml \
--path protos/sample
# save artifact to
SAVE ARTIFACT gen/sample AS LOCAL samplepb
compile-k8s:
COPY +vendor/files ./
RUN go build -mod=vendor -o bin/accounts ./actor-cluster/k8s
SAVE ARTIFACT bin/accounts /accounts
k8s-image:
FROM alpine:3.17
WORKDIR /app
COPY +compile-k8s/accounts ./accounts
RUN chmod +x ./accounts
# expose the various ports in the container
EXPOSE 50051
EXPOSE 50052
EXPOSE 3322
EXPOSE 3320
ENTRYPOINT ["./accounts"]
SAVE IMAGE accounts:dev
compile-dnssd:
COPY +vendor/files ./
RUN go build -mod=vendor -o bin/accounts ./actor-cluster/dnssd
SAVE ARTIFACT bin/accounts /accounts
dnssd-image:
FROM alpine:3.17
WORKDIR /app
COPY +compile-dnssd/accounts ./accounts
RUN chmod +x ./accounts
# expose the various ports in the container
EXPOSE 50051
EXPOSE 50052
EXPOSE 3322
EXPOSE 3320
EXPOSE 9092
ENTRYPOINT ["./accounts"]
SAVE IMAGE accounts:dev
compile-static:
COPY +vendor/files ./
RUN go build -mod=vendor -o bin/accounts ./actor-cluster/static
SAVE ARTIFACT bin/accounts /accounts
static-image:
FROM alpine:3.17
WORKDIR /app
COPY +compile-static/accounts ./accounts
RUN chmod +x ./accounts
# expose the various ports in the container
EXPOSE 50051
EXPOSE 50052
EXPOSE 3322
EXPOSE 3320
EXPOSE 9092
ENTRYPOINT ["./accounts"]
SAVE IMAGE accounts:dev