forked from earthly/earthly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
41 lines (35 loc) · 948 Bytes
/
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
VERSION 0.6
FROM golang:1.15-alpine3.13
WORKDIR /go-example
deps:
COPY go.mod go.sum ./
RUN go mod download
SAVE ARTIFACT go.mod AS LOCAL go.mod
SAVE ARTIFACT go.sum AS LOCAL go.sum
build:
FROM +deps
COPY main.go .
RUN go build -o build/go-example main.go
SAVE ARTIFACT build/go-example /go-example AS LOCAL build/go-example
docker:
COPY +build/go-example .
ENTRYPOINT ["/go-example/go-example"]
SAVE IMAGE --push earthly/examples:go
unit-test:
FROM +deps
COPY main.go .
COPY main_test.go .
RUN CGO_ENABLED=0 go test github.com/earthly/earthly/examples/go
integration-test:
FROM +deps
COPY main.go .
COPY main_integration_test.go .
COPY docker-compose.yml ./
WITH DOCKER --compose docker-compose.yml
RUN CGO_ENABLED=0 go test github.com/earthly/earthly/examples/go
END
all:
BUILD +build
BUILD +unit-test
BUILD +integration-test
BUILD +docker