Skip to content

Commit

Permalink
fix: set an explicit GOROOT in the Docker image for go-critic (#3106)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Aug 21, 2022
1 parent 63b2fe0 commit 970b0a5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
go.sum linguist-generated
Dockerfile.* linguist-language=Dockerfile
2 changes: 1 addition & 1 deletion .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
matrix:
target:
- Dockerfile: build/Dockerfile
- Dockerfile: build/Dockerfile.alpine
- Dockerfile: build/alpine.Dockerfile
steps:
- uses: actions/checkout@v3

Expand Down
2 changes: 2 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X

# stage 2
FROM golang:1.19
# related to https://github.com/golangci/golangci-lint/issues/3107
ENV GOROOT /usr/local/go
# don't place it into $GOPATH/bin because Drone mounts $GOPATH as volume
COPY --from=builder /golangci/golangci-lint /usr/bin/
CMD ["golangci-lint"]
2 changes: 2 additions & 0 deletions build/Dockerfile.alpine → build/alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ RUN CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$VERSION -X

# stage 2
FROM golang:1.19-alpine
# related to https://github.com/golangci/golangci-lint/issues/3107
ENV GOROOT /usr/local/go
# gcc is required to support cgo;
# git and mercurial are needed most times for go get`, etc.
# See https://github.com/docker-library/golang/issues/80
Expand Down

0 comments on commit 970b0a5

Please sign in to comment.