From 5ee078d699dbf62b9d80cf28b34a6b8b19d1bc04 Mon Sep 17 00:00:00 2001 From: lwih Date: Fri, 29 Dec 2023 12:22:10 +0100 Subject: [PATCH] Trivy - fix docker file --- .github/workflows/trivy.yml | 9 ++++++++- infra/docker/app/DockerfileCI | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml index cc3f5305..edca7264 100644 --- a/.github/workflows/trivy.yml +++ b/.github/workflows/trivy.yml @@ -41,11 +41,18 @@ jobs: id: buildx uses: docker/setup-buildx-action@v1 + - name: Get Version + id: getVersion + uses: ./backend + + - name: Print the version + run: echo "The version we just got is ${{ steps.getVersion.outputs.version }}" + - name: Build image uses: docker/build-push-action@v4 env: GITHUB_SHA: ${{ github.sha }} - VERSION: NO_VERSION + VERSION: ${{ steps.getVersion.outputs.version }} ENV_PROFILE: "prod" with: context: . diff --git a/infra/docker/app/DockerfileCI b/infra/docker/app/DockerfileCI index 8eefda09..7af82d8b 100644 --- a/infra/docker/app/DockerfileCI +++ b/infra/docker/app/DockerfileCI @@ -2,8 +2,8 @@ # Multi stage build # ##################### -ARG GITHUB_SHA=NO_COMMIT -ARG VERSION=NO_VERSION +ARG GITHUB_SHA +ARG VERSION ######################################## # Build rapportnav backend with maven # @@ -18,8 +18,8 @@ RUN mvn dependency:go-offline -B # Stage 2: Build the application FROM maven:3.8.5-openjdk-17-slim as build-backend -ARG GITHUB_SHA=NO_COMMIT -ARG VERSION=NO_VERSION +ARG GITHUB_SHA +ARG VERSION WORKDIR /tmp/backend COPY backend/ /tmp/backend