Commit 535f3c78 authored by Alfonso Orta's avatar Alfonso Orta

modify dockerfile to build java code

parent f7a14e92
...@@ -2,15 +2,22 @@ FROM maven:3.6.3-jdk-11 ...@@ -2,15 +2,22 @@ FROM maven:3.6.3-jdk-11
MAINTAINER S. Koulouzis MAINTAINER S. Koulouzis
ARG SONAR_PROPERTIES_FILE=uva-conf.properties
# Install SonarQube Dependency
RUN wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip && \
unzip sonar-scanner-cli-4.2.0.1873-linux.zip && \
mv sonar-scanner-4.2.0.1873-linux /opt/sonar-scanner
COPY clone_git.sh clone_git.sh COPY clone_git.sh clone_git.sh
COPY build.sh build.sh COPY build.sh build.sh
COPY send_to_sonarqube.sh send_to_sonarqube.sh COPY send_to_sonarqube.sh send_to_sonarqube.sh
CMD ./clone_git.sh $BRANCH $GIT_URL $FOLDER_NAME && \ CMD ./clone_git.sh $BRANCH $GIT_URL $FOLDER_NAME && \
./build.sh $FOLDER_NAME && \ ./build.sh $FOLDER_NAME && \
./send_to_sonarqube.sh $FOLDER_NAME $SONAR_HOST $SONAR_LOGIN ./send_to_sonarqube.sh $FOLDER_NAME $SONAR_HOST $SONAR_LOGIN $SONAR_PROPERTIES_FILE
# docker build -t java_ci . # docker build -t java_ci -build-arg SONAR_PROPERTIES_FILE=uva-conf.properties .
# docker run -it -e BRANCH=develop -e GIT_URL=https://gitlab.articonf.eu:4430/uva/conf.git -e FOLDER_NAME=conf java_ci -e SONAR_HOST=host -e SONAR_LOGIN=secret # docker run -it -e BRANCH=develop -e GIT_URL=https://gitlab.articonf.eu:4430/uva/conf.git -e FOLDER_NAME=conf -e SONAR_HOST=https://sonar.articonf.eu/ -e SONAR_LOGIN= -e SONAR_PROPERTIES_FILE=uva-conf.properties -e FOLDER_NAME=conf java_ci
\ No newline at end of file
...@@ -5,4 +5,4 @@ BRANCH=$1 ...@@ -5,4 +5,4 @@ BRANCH=$1
GIT_URL=$2 GIT_URL=$2
FOLDER_NAME=$3 FOLDER_NAME=$3
git clone -b $BRANCH $GIT_URL git clone -b $BRANCH $GIT_URL $FOLDER_NAME
#!/bin/bash #!/bin/bash
FOLDER_NAME=$1
SRC=$1
SONAR_HOST=$2 SONAR_HOST=$2
SONAR_LOGIN=$3 SONAR_LOGIN=$3
SONAR_PROPERTIES_FILE=$4
/opt/sonar-scanner/bin/sonar-scanner -X -e -D sonar.host.url=$SONAR_HOST -D sonar.projectBaseDir=$FOLDER_NAME -D project.settings=$SONAR_PROPERTIES_FILE -D sonar.login=$SONAR_LOGIN
cd $SRC \ No newline at end of file
for i in $(find . -name target); do # Not recommended, will break on whitespace
echo "Sending $i"
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment