github.com/chenfeining/golangci-lint@v1.0.2-0.20230730162517-14c6c67868df/build/alpine.Dockerfile (about)

     1  # stage 1 building the code
     2  FROM golang:1.20-alpine as builder
     3  
     4  ARG VERSION
     5  ARG SHORT_COMMIT
     6  ARG DATE
     7  
     8  COPY / /golangci
     9  WORKDIR /golangci
    10  
    11  # gcc is required to support cgo;
    12  # git and mercurial are needed most times for go get`, etc.
    13  # See https://github.com/docker-library/golang/issues/80
    14  RUN apk --no-cache add gcc musl-dev git mercurial
    15  RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X main.commit=$SHORT_COMMIT -X main.date=$DATE" -o golangci-lint ./cmd/golangci-lint/main.go
    16  
    17  # stage 2
    18  FROM golang:1.20-alpine
    19  # related to https://github.com/chenfeining/golangci-lint/issues/3107
    20  ENV GOROOT /usr/local/go
    21  # gcc is required to support cgo;
    22  # git and mercurial are needed most times for go get`, etc.
    23  # See https://github.com/docker-library/golang/issues/80
    24  RUN apk --no-cache add gcc musl-dev git mercurial
    25  # don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
    26  COPY --from=builder /chenfeining/golangci-lint /usr/bin/
    27  CMD ["golangci-lint"]