-
Notifications
You must be signed in to change notification settings - Fork 18
/
Earthfile
80 lines (70 loc) · 2.86 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
VERSION 0.6
FROM golang:1.20
WORKDIR /go/storj-up
gatewaymt-bin:
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build -o release/earthly/gateway-mt storj.io/edge/cmd/gateway-mt
SAVE ARTIFACT release/earthly binaries AS LOCAL release/earthly
authservice-bin:
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build -o release/earthly/authservice storj.io/edge/cmd/authservice
SAVE ARTIFACT release/earthly binaries AS LOCAL release/earthly
linksharing-bin:
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go build -o release/earthly/linksharing storj.io/edge/cmd/linksharing
SAVE ARTIFACT release/earthly binaries AS LOCAL release/earthly
build-storjup:
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 go install storj.io/storj-up@main
SAVE ARTIFACT /go/bin binaries AS LOCAL dist/up
deploy-remote:
FROM ubuntu
RUN apt-get update && apt-get install -y git wget unzip
RUN cd /tmp && wget https://releases.hashicorp.com/nomad/1.3.5/nomad_1.3.5_linux_amd64.zip -O nomad.zip && unzip nomad.zip && mv nomad /usr/local/bin && rm nomad.zip
COPY +build-storjup/binaries /usr/local/bin
COPY .git .git
ARG TAG=$(git rev-parse --short HEAD)
ARG IMAGE=img.dev.storj.io/dev/edge
BUILD +build-tagged-image --TAG=$TAG
ARG --required nomad
ARG --required ip
ENV NOMAD_ADDR=$nomad
RUN storj-up init nomad --name=edge --ip=$ip edge
RUN storj-up image gateway-mt,linksharing,authservice $IMAGE:$TAG
RUN --push nomad run --verbose storj.hcl
build-image:
FROM storjlabs/ci
COPY .git .git
ARG TAG=$(git rev-parse --short HEAD)
BUILD +build-tagged-image --TAG=$TAG
build-tagged-image:
ARG --required TAG
ARG --required IMAGE
FROM img.dev.storj.io/storjup/base:20221011-2
COPY +gatewaymt-bin/binaries /var/lib/storj/go/bin/
COPY +linksharing-bin/binaries /var/lib/storj/go/bin/
COPY +authservice-bin/binaries /var/lib/storj/go/bin/
COPY +build-storjup/binaries /var/lib/storj/go/bin/
SAVE IMAGE --push $IMAGE:$TAG $IMAGE:latest
run:
LOCALLY
RUN docker-compose up
check-format:
COPY . .
RUN mkdir build
RUN bash -c '[[ $(git status --short) == "" ]] || (echo "Before formatting, please commit all your work!!! (Formatter will format only last commit)" && exit -1)'
RUN git show --name-only --pretty=format: | grep ".go" | xargs --no-run-if-empty -n1 gofmt -s -w
RUN git diff > build/format.patch
SAVE ARTIFACT build/format.patch
format:
LOCALLY
COPY +check-format/format.patch build/format.patch
RUN git apply --allow-empty build/format.patch
RUN git status