Skip to content

Commit

Permalink
CI - updates for trivy and sonar
Browse files Browse the repository at this point in the history
  • Loading branch information
lwih committed Jan 21, 2024
1 parent 120f6eb commit f52d4a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ back-check-dependencies:

back-sonar:
cd $(BACKEND_DIR) && ./gradlew sonar \
--stacktrace \
--debug \
-Dsonar.projectKey$(projectKey) \
-Dsonar.organization=$(organization) \
-Dsonar.host.url=$(url) \
Expand Down
36 changes: 18 additions & 18 deletions infra/docker/app/DockerfileCI
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ ARG VERSION
########################################
# Build rapportnav backend with maven #
########################################
# Stage 1: Download maven dependencies
# this stage will not run if dependencies have not changed
FROM maven:3.8.5-openjdk-17-slim as maven-dependencies
WORKDIR /tmp/backend
COPY backend/pom.xml pom.xml
RUN mvn dependency:go-offline -B

# Stage 2: Build the application
FROM maven:3.8.5-openjdk-17-slim as build-backend
FROM gradle:8.5-jdk17 as build-backend

ARG GITHUB_SHA
ARG VERSION

WORKDIR /tmp/backend
COPY backend/ /tmp/backend
COPY --from=maven-dependencies /root/.m2 /root/.m2
COPY backend/pom.xml /tmp/backend/POM_WITH_ENV_VARS
RUN sed -e 's/COMMIT_TO_CHANGE/${GITHUB_SHA}/' \
-e 's/VERSION_TO_CHANGE/${VERSION}/' \
POM_WITH_ENV_VARS > pom.xml
#WORKDIR /tmp/backend
#COPY backend/ /tmp/backend
#COPY --from=maven-dependencies /root/.m2 /root/.m2
#COPY backend/pom.xml /tmp/backend/POM_WITH_ENV_VARS
#RUN sed -e 's/COMMIT_TO_CHANGE/${GITHUB_SHA}/' \
# -e 's/VERSION_TO_CHANGE/${VERSION}/' \
# POM_WITH_ENV_VARS > pom.xml
#
#RUN mvn clean package -DskipTests=true

WORKDIR /tmp/

RUN mvn clean package -DskipTests=true
COPY --chown=gradle:gradle backend/ /tmp/
COPY --chown=gradle:gradle backend/build.gradle.kts /tmp/build.gradle.kts
RUN chown -R gradle /tmp/*
USER gradle
RUN gradle assemble



Expand Down Expand Up @@ -71,7 +71,7 @@ ENV SPRING_PROFILES_ACTIVE=$ENV_PROFILE
ENV ENV_DB_URL=""

# copy backend related things
COPY --from=build-backend /tmp/backend/target/rapportnav-${VERSION}.jar /home/rapportnav
COPY --from=build-backend /tmp/build/libs/rapportnav-${VERSION}.jar /home/rapportnav
COPY infra/configurations/backend /home/rapportnav/configurations/

# copy frontend related things
Expand Down

0 comments on commit f52d4a4

Please sign in to comment.