diff --git a/Dockerfile b/Dockerfile index 7164f45..4b88596 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,9 +5,9 @@ ARG MAVEN_ACCOUNT_USR ARG MAVEN_ACCOUNT_PSW ARG REVISION ARG PROFILE -ARG DEV_PROFILE_URL ENV server_username=$MAVEN_ACCOUNT_USR ENV server_password=$MAVEN_ACCOUNT_PSW +ARG CITE_MAVEN_REPO_URL COPY pom.xml /build/ COPY core /build/core/ @@ -19,9 +19,9 @@ RUN rm -f /build/web/src/main/resources/config/*-dev.yml WORKDIR /build/ -RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} dependency:go-offline -# Build project -RUN mvn -Drevision=${REVISION} -DdevProfileUrl=${DEV_PROFILE_URL} -P${PROFILE} clean package +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 Stage ######################################## FROM eclipse-temurin:21-jre-alpine diff --git a/Dockerfile.Sonar b/Dockerfile.Sonar new file mode 100644 index 0000000..6187a91 --- /dev/null +++ b/Dockerfile.Sonar @@ -0,0 +1,28 @@ +####################################### 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 pom.xml /build/ +COPY core /build/core/ +COPY web /build/web/ +COPY settings.xml /root/.m2/settings.xml +RUN rm -f /build/web/src/main/resources/config/*-dev.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 -Drevision=${REVISION} -DciteMavenRepoUrl=${CITE_MAVEN_REPO_URL} -P${PROFILE} -Dsonar.projectKey=OpenDMP:repository-deposit-zenodo -Dsonar.login=${ORACLE_TOKEN} -Dsonar.host.url=${ORACLE_URL} -Dsonar.projectName='OpenDMP repository-deposit-zenodo' \ No newline at end of file diff --git a/settings.xml b/settings.xml index b2cc971..847f42c 100644 --- a/settings.xml +++ b/settings.xml @@ -1,29 +1,33 @@ + + org.sonarsource.scanner.maven + - ossrh - ${server_username} - ${server_password} - - - dev + cite-repo ${server_username} ${server_password} - dev + release - dev - Dev Profile - ${devProfileUrl} + central + Central Repository + https://repo.maven.apache.org/maven2 + default + + false + + + + cite-repo + CITE Maven Repo + ${citeMavenRepoUrl} - - true - - \ No newline at end of file +