run sonar from docker

This commit is contained in:
Timo Bejan 2021-11-22 16:51:59 +02:00
parent 6dfec774c7
commit 92e34c6265

View File

@ -1,6 +1,5 @@
FROM node:14.17-alpine as prep
RUN apk add --update jq && rm -rf /var/cache/apk/*
FROM node:14.18-buster as prep
RUN apt-get update && apt-get install -y jq
COPY package.json /tmp
RUN jq '{ dependencies, devDependencies, peerDependencies, scripts: (.scripts | { postinstall }) }' < /tmp/package.json > /tmp/deps.json
@ -9,13 +8,16 @@ RUN jq '{ dependencies, devDependencies, peerDependencies, scripts: (.scripts |
### STAGE 1: Build ###
# We label our stage as builder
FROM node:14.17-alpine as builder
FROM node:14.18-buster as builder
COPY --from=prep /tmp/deps.json ./package.json
COPY yarn.lock ./
## Storing node modules on a separate layer will prevent unnecessary npm installs at each build
RUN yarn install && mkdir /ng-app && mv ./node_modules ./ng-app
WORKDIR /ng-app
COPY apps apps
@ -32,15 +34,16 @@ COPY paligo-styles paligo-styles
COPY sonar.js sonar.js
## Build the angular app in production mode and store the artifacts in dist folder
RUN node sonar.js
RUN yarn run build-lint-all
RUN yarn run build-paligo-styles
RUN node sonar.js
CMD ["/bin/cp", "-r", "/ng-app/dist/paligo-styles", "/tmp/styles-export"]
### STAGE 2: Setup ###
FROM nginx:1.19.2-alpine
FROM nginx:1.21.4-alpine
RUN apk add --update nano && rm -rf /var/cache/apk/*
## Copy our default nginx config