forked from remilapeyre/vault-acme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
56 lines (48 loc) · 1.62 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
VERSION 0.6
FROM golang:1.20
WORKDIR /vault-acme
vault:
FROM hashicorp/vault:1.14
SAVE ARTIFACT /bin/vault
deps:
RUN go install github.com/letsencrypt/pebble/...@HEAD
COPY --dir ./acme/sidecar/ ./acme/sidecar
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
SAVE ARTIFACT ~/go/bin/pebble
build:
FROM +deps
RUN mkdir ./bin
COPY --dir ./cmd .
COPY --dir ./acme .
RUN CGO_ENABLED=0 go build -o bin ./...
SAVE ARTIFACT bin/acme /acme AS LOCAL bin/acme
SAVE ARTIFACT bin/sidecar /sidecar AS LOCAL bin/sidecar
test:
FROM +deps
COPY --dir ./test .
COPY --dir ./cmd .
COPY --dir ./acme .
RUN CGO_ENABLED=0 go test ./acme
testacc:
FROM +deps
ENV PATH=$PATH:~/go/bin
COPY +vault/vault /usr/bin
COPY +build/acme bin/acme
COPY --dir ./test .
RUN CGO_ENABLED=0 go test ./test
release:
FROM +deps
# ARG GOX_OS='linux darwin windows freebsd openbsd solaris'
ARG GOX_OS='linux'
RUN go install github.com/mitchellh/gox@HEAD
RUN apt update && apt install zip -y
COPY --dir ./cmd .
COPY --dir ./acme .
RUN CGO_ENABLED=0 gox -os="$GOX_OS" -arch='amd64' -osarch='!darwin/arm !darwin/386' -output 'bin/{{.OS}}_{{.Arch}}/acme-plugin' ./cmd/acme
RUN CGO_ENABLED=0 gox -os="$GOX_OS" -arch='amd64' -osarch='!darwin/arm !darwin/386' -output 'bin/{{.OS}}_{{.Arch}}/sidecar' ./cmd/sidecar
RUN for arch in ./bin/*; do zip --junk-paths $arch.zip $arch/*; done
RUN sha256sum ./bin/*.zip > ./bin/vault-acme_SHA256SUMS
SAVE ARTIFACT ./bin /release AS LOCAL ./bin