generated from prairir/project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEarthfile
57 lines (44 loc) · 1.09 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
# getting the dependencies
deps:
FROM golang:1.16
WORKDIR /app
COPY go.mod go.sum .
RUN go mod download
# builds the client binary
build:
# build off of deps stage
FROM +deps
# copy main file
COPY main.go .
# copy cmd and whatever else in dir mode
# this is like `cp -r`
COPY --dir cmd/ pkg/ ./
# build to file `imacry`
RUN go build -race -o imacry main.go
# save file as artifact
SAVE ARTIFACT imacry
# gets the binary from build and then saves it to local machine
save-binary:
FROM scratch
COPY +build/imacry imacry
SAVE ARTIFACT imacry AS LOCAL imacry
# make docker container
docker:
FROM ubuntu:21.04
COPY +build/imacry imacry
SAVE IMAGE imacry-run:latest
# make the benchmarking files
make-benchmark:
FROM ubuntu:21.04
# copy shell script
COPY scripts/test_filebenchmarks.sh .
# make it executable and then run it
RUN chmod +x test_filebenchmarks.sh && \
./test_filebenchmarks.sh
SAVE ARTIFACT /root/file*
# benchmarking docker container
benchmark:
FROM +build
COPY +make-benchmark/file* /root/
CMD ["go", "test", "-bench=.", "./..."]
SAVE IMAGE imacry-benchmark:latest