-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathDockerfile
34 lines (30 loc) · 1.01 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
FROM nginx:alpine AS base
RUN rm -rf /usr/share/nginx/html/*
COPY ./start.sh start.sh
COPY ./nginx/nginx.conf.template /etc/nginx/conf.d/nginx.conf.template
# If you update node version, please also update the node version in the .nvmrc file.
FROM node:18 AS builder
COPY ./website/package.json /app/website/package.json
COPY ./website/package-lock.json /app/website/package-lock.json
WORKDIR /app/website
RUN npm install
COPY ./website /app/website
RUN npm run build
FROM sonarsource/sonar-scanner-cli:4 AS sonarqube_scan
WORKDIR /app
ARG SONAR_TOKEN
COPY --from=builder /app/website/build /app
RUN if [ -z "$SONAR_TOKEN" ] \
; then \
echo Sonar scan skipped \
; else \
sonar-scanner \
-Dsonar.host.url="https://sonarcloud.io" \
-Dsonar.login="$SONAR_TOKEN" \
-Dsonar.projectKey="configcat_docs" \
-Dsonar.projectName="docs" \
-Dsonar.organization="configcat" \
; fi
FROM base as final
COPY --from=builder /app/website/build /usr/share/nginx/temphtml
CMD ["sh", "start.sh"]