-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
37 lines (27 loc) · 1.25 KB
/
Dockerfile
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
FROM golang:1.21-alpine as build
RUN apk add --no-cache --update git
RUN mkdir -p /go/src/github.com/diegopereiraeng/harness-cie-sonarqube-scanner
WORKDIR /go/src/github.com/diegopereiraeng/harness-cie-sonarqube-scanner
COPY *.go ./
COPY *.mod ./
RUN go env GOCACHE
RUN go get github.com/sirupsen/logrus
RUN go get github.com/pelletier/go-toml/cmd/tomll
RUN go get github.com/urfave/cli
RUN go get github.com/joho/godotenv
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o harness-sonar
FROM amazoncorretto:17.0.11-alpine3.19
ARG SONAR_VERSION=5.0.1.3006
ARG SONAR_SCANNER_CLI=sonar-scanner-cli-${SONAR_VERSION}
ARG SONAR_SCANNER=sonar-scanner-${SONAR_VERSION}
# RUN apt-get update \
# && apt-get install -y nodejs curl \
# && apt-get clean
RUN apk --no-cache --update add nodejs-current npm curl unzip git php python3 py3-pip maven gcc g++ make ruby ruby-dev perl
COPY --from=build /go/src/github.com/diegopereiraeng/harness-cie-sonarqube-scanner/harness-sonar /bin/
WORKDIR /bin
RUN curl https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/${SONAR_SCANNER_CLI}.zip -so /bin/${SONAR_SCANNER_CLI}.zip
RUN unzip ${SONAR_SCANNER_CLI}.zip \
&& rm ${SONAR_SCANNER_CLI}.zip
ENV PATH $PATH:/bin/${SONAR_SCANNER}/bin
ENTRYPOINT /bin/harness-sonar