drone-sonar-plugin/Dockerfile

36 lines
1.2 KiB
Docker
Raw Normal View History

2024-09-17 23:35:05 +00:00
FROM golang:1.15-alpine as build
RUN mkdir -p /go/src/github.com/aosapps/drone-sonar-plugin
WORKDIR /go/src/github.com/aosapps/drone-sonar-plugin
COPY *.go ./
COPY vendor ./vendor/
2024-09-17 23:35:05 +00:00
RUN GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o drone-sonar
2024-09-17 23:35:05 +00:00
FROM openjdk:17-slim-bullseye
2018-08-28 16:39:09 +00:00
2024-09-17 23:35:05 +00:00
ARG SONAR_VERSION=5.0.1.3006
2019-02-12 10:17:23 +00:00
ARG SONAR_SCANNER_CLI=sonar-scanner-cli-${SONAR_VERSION}
ARG SONAR_SCANNER=sonar-scanner-${SONAR_VERSION}
2024-09-17 23:35:05 +00:00
ARG NODEJS_VERSION=20
2019-02-12 10:17:23 +00:00
2020-10-13 14:46:41 +00:00
RUN apt-get update \
2024-09-17 23:35:05 +00:00
&& apt-get install -y curl gpg unzip \
&& apt-get clean
RUN echo "deb https://deb.nodesource.com/node_${NODEJS_VERSION}.x bookworm main" | tee /etc/apt/sources.list.d/nodesource.list
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/nodesource.gpg >/dev/null
RUN apt-get update \
&& apt-get install -y nodejs \
2020-10-13 14:46:41 +00:00
&& apt-get clean
COPY --from=build /go/src/github.com/aosapps/drone-sonar-plugin/drone-sonar /bin/
2018-08-28 16:39:09 +00:00
WORKDIR /bin
2019-02-12 10:17:23 +00:00
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 \
2020-10-13 14:46:41 +00:00
&& rm ${SONAR_SCANNER_CLI}.zip
2019-02-12 10:17:23 +00:00
ENV PATH $PATH:/bin/${SONAR_SCANNER}/bin
2018-08-28 16:39:09 +00:00
ENTRYPOINT /bin/drone-sonar