File tree 4 files changed +53
-21
lines changed
4 files changed +53
-21
lines changed Original file line number Diff line number Diff line change 26
26
args : release --rm-dist
27
27
env :
28
28
GITHUB_TOKEN : ${{ secrets.GOLANGCI_LINT_TOKEN }}
29
+ - name : Prepare
30
+ id : prepare
31
+ run : |
32
+ TAG=${GITHUB_REF#refs/tags/}
33
+ MAJOR=${TAG%.*}
34
+ echo ::set-output name=tag_name::${TAG}
35
+ echo ::set-output name=major_tag::${MAJOR}
36
+ - name : Set up QEMU
37
+ uses : docker/setup-qemu-action@v1
38
+ - name : Set up Docker Buildx
39
+ uses : docker/setup-buildx-action@v1
40
+ - name : build and publish main image
41
+ id : docker_build
42
+ uses : docker/build-push-action@v2
43
+ with :
44
+ context : .
45
+ file : build/Dockerfile
46
+ platforms : linux/amd64,linux/arm64
47
+ push : true
48
+ tags : |
49
+ golangci/golangci-lint:${{ steps.prepare.outputs.tag_name }}
50
+ golangci/golangci-lint:${{ steps.prepare.outputs.major_tag }}
51
+ golangci/golangci-lint:latest
52
+ - name : build and publish alpine image
53
+ id : docker_build_alpine
54
+ uses : docker/build-push-action@v2
55
+ with :
56
+ context : .
57
+ file : build/Dockerfile.alpine
58
+ platforms : linux/amd64,linux/arm64
59
+ push : true
60
+ tags : |
61
+ golangci/golangci-lint:${{ steps.prepare.outputs.tag_name }}-alpine
62
+ golangci/golangci-lint:${{ steps.prepare.outputs.major_tag }}-alpine
63
+ golangci/golangci-lint:latest-alpine
Original file line number Diff line number Diff line change @@ -63,22 +63,6 @@ changelog:
63
63
- Merge pull request
64
64
- Merge branch
65
65
66
- dockers :
67
- - dockerfile : build/Dockerfile
68
- binaries :
69
- - golangci-lint
70
- image_templates :
71
- - " golangci/golangci-lint:latest"
72
- - " golangci/golangci-lint:{{ .Tag }}"
73
- - " golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}"
74
- - dockerfile : build/Dockerfile.alpine
75
- binaries :
76
- - golangci-lint
77
- image_templates :
78
- - " golangci/golangci-lint:latest-alpine"
79
- - " golangci/golangci-lint:{{ .Tag }}-alpine"
80
- - " golangci/golangci-lint:v{{ .Major }}.{{ .Minor }}-alpine"
81
-
82
66
brews :
83
67
- tap :
84
68
owner : golangci
Original file line number Diff line number Diff line change 1
- FROM golang:1.15
1
+ # stage 1 building the code
2
+ FROM golang:1.15 as builder
3
+
4
+ COPY / /golangci
5
+ WORKDIR /golangci
6
+ RUN go build -o golangci-lint ./cmd/golangci-lint/main.go
2
7
8
+ # stage 2
9
+ FROM golang:1.15
3
10
# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
4
- COPY golangci-lint /usr/bin/
11
+ COPY --from=builder /golangci/ golangci-lint /usr/bin/
5
12
CMD ["golangci-lint" ]
Original file line number Diff line number Diff line change 1
- FROM golang:1.15-alpine
1
+ # stage 1 building the code
2
+ FROM golang:1.15-alpine as builder
3
+
4
+ COPY / /golangci
5
+ WORKDIR /golangci
6
+ RUN CGO_ENABLED=0 go build -o golangci-lint ./cmd/golangci-lint/main.go
2
7
8
+ # stage 2
9
+ FROM golang:1.15-alpine
3
10
# gcc is required to support cgo;
4
11
# git and mercurial are needed most times for go get`, etc.
5
12
# See https://github.com/docker-library/golang/issues/80
6
13
RUN apk --no-cache add gcc musl-dev git mercurial
7
-
8
14
# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
9
- COPY golangci-lint /usr/bin/
15
+ COPY --from=builder /golangci/ golangci-lint /usr/bin/
10
16
CMD ["golangci-lint"]
You can’t perform that action at this time.
0 commit comments