diff --git a/Dockerfile.Sonar b/Dockerfile.Sonar deleted file mode 100644 index c6a20d0ba..000000000 --- a/Dockerfile.Sonar +++ /dev/null @@ -1,92 +0,0 @@ -####################################### Build stage ####################################### -FROM maven:3.9-eclipse-temurin-21-alpine - -ARG MAVEN_ACCOUNT_USR -ARG MAVEN_ACCOUNT_PSW -ARG REVISION -ARG PROFILE -ARG ORACLE_URL -ARG ORACLE_TOKEN -ARG BUILD -ENV server_username=$MAVEN_ACCOUNT_USR -ENV server_password=$MAVEN_ACCOUNT_PSW -ARG CITE_MAVEN_REPO_URL - -COPY /dmp-backend/pom.xml /build/ -COPY /dmp-backend/core /build/core/ -COPY /dmp-backend/web /build/web/ -COPY /dmp-backend/settings.xml /root/.m2/settings.xml -RUN rm -f /build/web/src/main/resources/config/*-devel.yml -RUN rm -f /build/web/src/main/resources/logging/*.xml - -COPY /notification-service/pom.xml /build-notification/ -COPY /notification-service/core /build-notification/core/ -COPY /notification-service/web /build-notification/web/ -COPY /notification-service/settings.xml /root/.m2/settings.xml -RUN rm -f /build/notification-web/src/main/resources/config/app.env -RUN rm -f /build/notification-web/src/main/resources/config/*-devel.yml -RUN rm -f /build/notification-web/src/main/resources/logging/*.xml -RUN rm -f /build/notification-web/src/main/resources/certificates/*.crt - -COPY /annotation-service/pom.xml /build-annotation/ -COPY /annotation-service/annotation /build-notification/annotation/ -COPY /annotation-service/annotation-web /build-notification/annotation-web/ -COPY /annotation-service/settings.xml /root/.m2/settings.xml -RUN rm -f /build/annotation-web/src/main/resources/config/app.env -RUN rm -f /build/annotation-web/src/main/resources/config/*-devel.yml -RUN rm -f /build/annotation-web/src/main/resources/logging/*.xml -RUN rm -f /build/annotation-web/src/main/resources/certificates/*.crt - -COPY oracle.local.cite.gr.crt $JAVA_HOME/conf/security -RUN cd "$JAVA_HOME"/conf/security && keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias oraclecert -file oracle.local.cite.gr.crt - -WORKDIR /build/ -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package -RUN mvn sonar:sonar -Dsonar.projectKey=OpenDMP:backend-api -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP API' - -WORKDIR /build-notification/ -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package -RUN mvn sonar:sonar -Dsonar.projectKey=OpenDMP:notification-api -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP Notification API' - -WORKDIR /build-annotation/ -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install -RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package -RUN mvn sonar:sonar -Dsonar.projectKey=OpenDMP:annotation-api -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP Annotation API' - -################################## frontend analysis ########################################## -FROM node:20 - -ARG ORACLE_URL -ARG ORACLE_TOKEN -ARG BUILD_VERSION -ENV ORACLE_URL=$ORACLE_URL -ENV ORACLE_TOKEN=$ORACLE_TOKEN -ENV BUILD_VERSION=$BUILD_VERSION - -RUN apt-get -y update && apt-get install -y openjdk-11-jdk locales && apt-get clean -RUN mkdir -p /usr/share/man/man1/ -RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ - locale-gen -ENV LC_ALL en_US.UTF-8 -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en - -COPY oracle.local.cite.gr.crt /usr/local/share/ca-certificates/oracle.local.cite.gr.crt -RUN update-ca-certificates - -# copy the package.json to install dependencies -COPY /dmp-frontend/package.json ./ -COPY /dmp-frontend/package-lock.json ./ - -# Install the dependencies and make the folder -RUN npm install sonar-scanner --save-dev -RUN npm install --legacy-peer-deps && mkdir /src && mv ./node_modules ./src - -WORKDIR /src -COPY . . -RUN npm run sonar-scanner \ No newline at end of file diff --git a/annotation-service/Dockerfile.Sonar b/annotation-service/Dockerfile.Sonar new file mode 100644 index 000000000..c84e907bd --- /dev/null +++ b/annotation-service/Dockerfile.Sonar @@ -0,0 +1,30 @@ +####################################### Build stage ####################################### +FROM maven:3.9-eclipse-temurin-21-alpine + +ARG MAVEN_ACCOUNT_USR +ARG MAVEN_ACCOUNT_PSW +ARG REVISION +ARG PROFILE +ARG ORACLE_URL +ARG ORACLE_TOKEN +ENV server_username=$MAVEN_ACCOUNT_USR +ENV server_password=$MAVEN_ACCOUNT_PSW +ARG CITE_MAVEN_REPO_URL + +COPY /annotation-service/pom.xml /build-annotation/ +COPY /annotation-service/annotation /build-notification/annotation/ +COPY /annotation-service/annotation-web /build-notification/annotation-web/ +COPY /annotation-service/settings.xml /root/.m2/settings.xml +RUN rm -f /build/annotation-web/src/main/resources/config/app.env +RUN rm -f /build/annotation-web/src/main/resources/config/*-devel.yml +RUN rm -f /build/annotation-web/src/main/resources/logging/*.xml +RUN rm -f /build/annotation-web/src/main/resources/certificates/*.crt + +COPY oracle.local.cite.gr.crt $JAVA_HOME/conf/security +RUN cd "$JAVA_HOME"/conf/security && keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias oraclecert -file oracle.local.cite.gr.crt + +WORKDIR /build-annotation/ +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package +RUN mvn sonar:sonar -Dsonar.projectKey=OpenDMP:annotation-api -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP Annotation API' \ No newline at end of file diff --git a/dmp-backend/Dockerfile.Sonar b/dmp-backend/Dockerfile.Sonar new file mode 100644 index 000000000..e1e53b6b6 --- /dev/null +++ b/dmp-backend/Dockerfile.Sonar @@ -0,0 +1,29 @@ +####################################### Build stage ####################################### +FROM maven:3.9-eclipse-temurin-21-alpine + +ARG MAVEN_ACCOUNT_USR +ARG MAVEN_ACCOUNT_PSW +ARG REVISION +ARG PROFILE +ARG ORACLE_URL +ARG ORACLE_TOKEN +ENV server_username=$MAVEN_ACCOUNT_USR +ENV server_password=$MAVEN_ACCOUNT_PSW +ARG CITE_MAVEN_REPO_URL + +COPY /dmp-backend/pom.xml /build/ +COPY /dmp-backend/core /build/core/ +COPY /dmp-backend/web /build/web/ +COPY /dmp-backend/settings.xml /root/.m2/settings.xml +RUN rm -f /build/web/src/main/resources/config/*-devel.yml +RUN rm -f /build/web/src/main/resources/logging/*.xml + + +COPY oracle.local.cite.gr.crt $JAVA_HOME/conf/security +RUN cd "$JAVA_HOME"/conf/security && keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias oraclecert -file oracle.local.cite.gr.crt + +WORKDIR /build/ +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package +RUN mvn sonar:sonar -Dsonar.projectKey=OpenDMP:backend-api -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP API' \ No newline at end of file diff --git a/dmp-frontend/Dockerfile.Sonar b/dmp-frontend/Dockerfile.Sonar new file mode 100644 index 000000000..ab9910696 --- /dev/null +++ b/dmp-frontend/Dockerfile.Sonar @@ -0,0 +1,31 @@ +FROM node:20 + +ARG ORACLE_URL +ARG ORACLE_TOKEN +ARG BUILD_VERSION +ENV ORACLE_URL=$ORACLE_URL +ENV ORACLE_TOKEN=$ORACLE_TOKEN +ENV BUILD_VERSION=$BUILD_VERSION + +RUN apt-get -y update && apt-get install -y openjdk-11-jdk locales && apt-get clean +RUN mkdir -p /usr/share/man/man1/ +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ + locale-gen +ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en + +COPY oracle.local.cite.gr.crt /usr/local/share/ca-certificates/oracle.local.cite.gr.crt +RUN update-ca-certificates + +# copy the package.json to install dependencies +COPY /dmp-frontend/package.json ./ +COPY /dmp-frontend/package-lock.json ./ + +# Install the dependencies and make the folder +RUN npm install sonar-scanner --save-dev +RUN npm install --legacy-peer-deps && mkdir /src && mv ./node_modules ./src + +WORKDIR /src +COPY . . +RUN npm run sonar-scanner \ No newline at end of file diff --git a/sonar-project.properties b/dmp-frontend/sonar-project.properties similarity index 100% rename from sonar-project.properties rename to dmp-frontend/sonar-project.properties diff --git a/notification-service/Dockerfile.Sonar b/notification-service/Dockerfile.Sonar new file mode 100644 index 000000000..ce94626da --- /dev/null +++ b/notification-service/Dockerfile.Sonar @@ -0,0 +1,30 @@ +####################################### Build stage ####################################### +FROM maven:3.9-eclipse-temurin-21-alpine + +ARG MAVEN_ACCOUNT_USR +ARG MAVEN_ACCOUNT_PSW +ARG REVISION +ARG PROFILE +ARG ORACLE_URL +ARG ORACLE_TOKEN +ENV server_username=$MAVEN_ACCOUNT_USR +ENV server_password=$MAVEN_ACCOUNT_PSW +ARG CITE_MAVEN_REPO_URL + +COPY /notification-service/pom.xml /build-notification/ +COPY /notification-service/core /build-notification/core/ +COPY /notification-service/web /build-notification/web/ +COPY /notification-service/settings.xml /root/.m2/settings.xml +RUN rm -f /build/notification-web/src/main/resources/config/app.env +RUN rm -f /build/notification-web/src/main/resources/config/*-devel.yml +RUN rm -f /build/notification-web/src/main/resources/logging/*.xml +RUN rm -f /build/notification-web/src/main/resources/certificates/*.crt + +COPY oracle.local.cite.gr.crt $JAVA_HOME/conf/security +RUN cd "$JAVA_HOME"/conf/security && keytool -cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias oraclecert -file oracle.local.cite.gr.crt + +WORKDIR /build-notification/ +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} clean +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} install +RUN mvn -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} package +RUN mvn sonar:sonar -Dsonar.projectKey=OpenDMP:notification-api -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP Notification API' \ No newline at end of file