diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index fb2e064d9899c7c5a0ca243d10d49cbb853850d9..1190aeed4c18ef3a3c648b7198263df69ac4358b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,9 +19,9 @@ jobs: - uses: actions/checkout@v2 - name: Build the Docker image for branch ${GITHUB_REF##*/} run: DOCKER_BUILDKIT=1 docker build . \ - --env GITHUBLOGIN="$GITHUBLOGIN" \ - --env GITHUBPASSWORD="$GITHUBPASSWORD" \ - --env SONAR_HOST="$SONAR_HOST" \ - --env SONAR_TOKEN="$SONAR_TOKEN" \ + --build-arg GITHUBLOGIN \ + --build-arg GITHUBPASSWORD \ + --build-arg SONAR_URL \ + --build-arg SONAR_TOKEN \ --file ./docker/Dockerfile \ --tag brunoe/samplejee91:${GITHUB_REF##*/} diff --git a/docker-compose.yml b/docker-compose.yml index 87c0deecd0a7e2eb6b47c6087a21b9bcd0b7297f..67842851618b240b2ba565ae87fcdac951e80895 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: args: - GITHUBLOGIN - GITHUBPASSWORD - - SONAR_HOST + - SONAR_URL - SONAR_TOKEN context: . dockerfile: docker/Dockerfile diff --git a/docker/Dockerfile b/docker/Dockerfile index 8cf64ea7041b48430bbbc2e48f97333c464ec156..880e779a4179d3d550c64deb2a71e1bd4068758a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,5 +1,10 @@ ### First we build the application in docker in a controlled env FROM maven:3.8.4-eclipse-temurin-11 as build +ARG GITHUBLOGIN +ARG GITHUBPASSWORD +ARG SONAR_HOST +ARG SONAR_TOKEN + WORKDIR /app #see https://www.jrebel.com/blog/how-to-speed-up-your-maven-build diff --git a/docker/settings-docker.xml b/docker/settings-docker.xml index fc533f816970b25ea2f095c6420d57129b2f3eb6..3ccf09a14008f187fe8d4da3d6c1e40e79cffee5 100644 --- a/docker/settings-docker.xml +++ b/docker/settings-docker.xml @@ -28,7 +28,7 @@ <profile> <id>sonar</id> <properties> - <sonar.host.url>${env.SONAR_HOST}</sonar.host.url> + <sonar.host.url>${env.SONAR_URL}</sonar.host.url> <sonar.login>${env.SONAR_TOKEN}</sonar.login> </properties> </profile> diff --git a/pom.xml b/pom.xml index ebb140a908aa2fab47637708db04cfbc7d48119b..6c8b48b87861e7e4a76bd26ecb6061c2c5175990 100644 --- a/pom.xml +++ b/pom.xml @@ -173,6 +173,7 @@ <dependency> <groupId>org.jboss.logging</groupId> <artifactId>jboss-logging-annotations</artifactId> + <version>2.2.1.Final</version> <exclusions> <exclusion> <groupId>org.jboss.logging</groupId> @@ -298,4 +299,25 @@ </repository> </repositories> + <profiles> + <profile> + <id>sonar</id> + <build> + <plugins> + <!--Sonarquve --> + <plugin> + <groupId>org.sonarsource.scanner.maven</groupId> + <artifactId>sonar-maven-plugin</artifactId> + <version>3.9.1.2184</version> + </plugin> + <plugin> + <groupId>io.github.r0bb3n</groupId> + <artifactId>sonar-quality-gate-maven-plugin</artifactId> + <version>1.1.0</version> + </plugin> + </plugins> + </build> + </profile> + </profiles> + </project>