1
- FROM golang:1.13-alpine3.11
1
+ VERSION 0.7
2
+ FROM golang:1.20-alpine3.17
2
3
3
4
RUN apk add --update --no-cache \
4
5
bash \
@@ -18,38 +19,23 @@ RUN apk add --update --no-cache \
18
19
shellcheck \
19
20
util-linux
20
21
22
+
23
+
21
24
WORKDIR /secretshare
22
25
23
26
deps :
24
- RUN go get golang.org/x/tools/cmd/goimports
25
- RUN go get golang.org/x/lint/golint
27
+ RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.50.0
26
28
COPY go.mod go.sum .
27
- RUN go mod download
28
- SAVE IMAGE
29
+ RUN go mod download
29
30
30
31
code :
31
32
FROM +deps
32
33
COPY --dir cmd ./
33
- SAVE IMAGE
34
34
35
35
lint :
36
36
FROM +code
37
- RUN output= "$(ineffassign .)" ; \
38
- if [ -n "$output" ]; then \
39
- echo "$output" ; \
40
- exit 1 ; \
41
- fi
42
- RUN output= "$(goimports -d $(find . -type f -name '*.go' | grep -v \. pb\. go) 2>&1)" ; \
43
- if [ -n "$output" ]; then \
44
- echo "$output" ; \
45
- exit 1 ; \
46
- fi
47
- RUN golint -set_exit_status ./...
48
- RUN output= "$(go vet ./... 2>&1)" ; \
49
- if [ -n "$output" ]; then \
50
- echo "$output" ; \
51
- exit 1 ; \
52
- fi
37
+ COPY ./.golangci.yaml ./
38
+ RUN golangci-lint run
53
39
54
40
secretshare :
55
41
FROM +code
@@ -67,26 +53,44 @@ secretshare:
67
53
cmd/secretshare/main.go
68
54
SAVE ARTIFACT build/secretshare AS LOCAL "build/$GOOS/$GOARCH/secretshare"
69
55
70
- secretshare-darwin :
56
+ secretshare-darwin-amd64 :
71
57
COPY \
72
58
--build-arg GOOS= darwin \
73
59
--build-arg GOARCH= amd64 \
74
60
--build-arg GO_EXTRA_LDFLAGS= \
75
- +secretshare/* ./
76
- SAVE ARTIFACT ./*
61
+ +secretshare/secretshare /build/secretshare
62
+ SAVE ARTIFACT /build/secretshare AS LOCAL "build/darwin/amd64/secretshare"
77
63
78
- secretshare-linux :
64
+ secretshare-darwin-arm64 :
65
+ COPY \
66
+ --build-arg GOOS= darwin \
67
+ --build-arg GOARCH= arm64 \
68
+ --build-arg GO_EXTRA_LDFLAGS= \
69
+ +secretshare/secretshare /build/secretshare
70
+ SAVE ARTIFACT /build/secretshare AS LOCAL "build/darwin/arm64/secretshare"
71
+
72
+ secretshare-linux-amd64 :
79
73
COPY \
80
74
--build-arg GOOS= linux \
81
75
--build-arg GOARCH= amd64 \
82
76
--build-arg GO_EXTRA_LDFLAGS= "-linkmode external -extldflags -static" \
83
- +secretshare/* ./
84
- SAVE ARTIFACT ./*
77
+ +secretshare/secretshare /build/secretshare
78
+ SAVE ARTIFACT /build/secretshare AS LOCAL "build/linux/amd64/secretshare"
79
+
80
+ secretshare-linux-arm64 :
81
+ COPY \
82
+ --build-arg GOOS= linux \
83
+ --build-arg GOARCH= arm64 \
84
+ --build-arg GO_EXTRA_LDFLAGS= \
85
+ +secretshare/secretshare /build/secretshare
86
+ SAVE ARTIFACT /build/secretshare AS LOCAL "build/linux/arm64/secretshare"
85
87
86
88
secretshare-all :
87
- COPY +secretshare-linux/secretshare ./secretshare-linux-amd64
88
- COPY +secretshare-darwin/secretshare ./secretshare-darwin-amd64
89
- SAVE ARTIFACT ./*
89
+ BUILD +secretshare-linux-amd64
90
+ BUILD +secretshare-linux-arm64
91
+ BUILD +secretshare-darwin-amd64
92
+ BUILD +secretshare-darwin-arm64
93
+
90
94
91
95
test :
92
96
COPY +secretshare-linux/secretshare ./secretshare
0 commit comments