-
Notifications
You must be signed in to change notification settings - Fork 388
/
Earthfile
36 lines (31 loc) · 962 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
VERSION 0.8
FROM golang:1.21-alpine3.18
WORKDIR /go-workdir
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 output/example main.go
SAVE ARTIFACT output/example AS LOCAL local-output/go-example
docker:
ARG tag='latest'
COPY +build/example .
ENTRYPOINT ["/go-workdir/example"]
SAVE IMAGE --push earthly/examples:go
test-setup:
FROM +deps
COPY main.go .
COPY main_integration_test.go .
ENV CGO_ENABLED=0
ENTRYPOINT [ "go", "test", "github.com/earthly/earthly/examples/go"]
SAVE IMAGE test:latest
integration-tests:
FROM earthly/dind:alpine-3.19-docker-25.0.5-r0
COPY docker-compose.yml ./
WITH DOCKER --compose docker-compose.yml --load tests:latest=+test-setup
RUN docker run --network=default_go/part6_default tests:latest | grep "ok"
END