From de75034a09ef2f636109dd8b2be47559e548aee0 Mon Sep 17 00:00:00 2001 From: kbellouard Date: Mon, 7 Jul 2025 11:30:32 +0200 Subject: [PATCH 1/5] fix: env variables --- src/main/resources/application.properties | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5436e27..13ddc9f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,9 +1,12 @@ # Datasource configuration -spring.datasource.url=jdbc:postgresql://localhost:5432/DbToChange -spring.datasource.username=UserToChange -spring.datasource.password=PwdToChange +spring.datasource.url=${DB_URL:jdbc:postgresql://localhost:5432/sanalyz} +spring.datasource.username=${DB_USER:sanalyz} +spring.datasource.password=${DB_PASSWORD:sanalyz} spring.datasource.driver-class-name=org.postgresql.Driver # Hibernate & JPA settings spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true \ No newline at end of file +spring.jpa.show-sql=${SHOW_SQL:true} + +ai.api-url=${AI_API_URL:http://localhost:8080/api} +ai.api-key=${AI_API_KEY:abcd1234} From 28f7e25a2632f1f03b44eec1f91dcff7665ee766 Mon Sep 17 00:00:00 2001 From: Th4End Date: Tue, 8 Jul 2025 11:11:42 +0200 Subject: [PATCH 2/5] update --- Dockerfile | 10 ++++++++++ src/main/resources/application.properties | 14 +++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fbb5bd1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM maven:3.9.6-eclipse-temurin-21 + +WORKDIR /app + +COPY pom.xml . +COPY src ./src + +EXPOSE 8080 + +CMD ["mvn", "spring-boot:run", "-Dspring-boot.run.arguments=--server.address=0.0.0.0"] \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5436e27..41cd31f 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,9 +1,13 @@ # Datasource configuration -spring.datasource.url=jdbc:postgresql://localhost:5432/DbToChange -spring.datasource.username=UserToChange -spring.datasource.password=PwdToChange +spring.datasource.url=jdbc:postgresql://db:5432/sanalyz +spring.datasource.username=sanalyz +spring.datasource.password=sanalyz spring.datasource.driver-class-name=org.postgresql.Driver # Hibernate & JPA settings -spring.jpa.hibernate.ddl-auto=update -spring.jpa.show-sql=true \ No newline at end of file +spring.jpa.hibernate.ddl-auto=validate +spring.jpa.show-sql=true +server.address=0.0.0.0 + +ai.api-url=http://ia:8081 +ai.api-key=abcd1234 From f7c2f45fbe5115be081757f99e4cb93076f19f47 Mon Sep 17 00:00:00 2001 From: kbellouard Date: Tue, 8 Jul 2025 11:30:44 +0200 Subject: [PATCH 3/5] feat: ci-cd deployment --- src/main/resources/application.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 41cd31f..135e067 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,13 +1,13 @@ # Datasource configuration -spring.datasource.url=jdbc:postgresql://db:5432/sanalyz -spring.datasource.username=sanalyz -spring.datasource.password=sanalyz +spring.datasource.url=${DB_URL:jdbc:postgresql://localhost:5432/sanalyz} +spring.datasource.username=${DB_USER:sanalyz} +spring.datasource.password=${DB_PASSWORD:sanalyz} spring.datasource.driver-class-name=org.postgresql.Driver # Hibernate & JPA settings -spring.jpa.hibernate.ddl-auto=validate -spring.jpa.show-sql=true +spring.jpa.hibernate.ddl-auto=${DDL_AUTO:update} +spring.jpa.show-sql=${SHOW_SQL:true} server.address=0.0.0.0 -ai.api-url=http://ia:8081 -ai.api-key=abcd1234 +ai.api-url=${AI_API_URL:http://localhost:8081} +ai.api-key=${AI_API_KEY:abcd1234} From a0a14edf129e140697c7ea444f5a2b509c22cf90 Mon Sep 17 00:00:00 2001 From: kbellouard Date: Tue, 8 Jul 2025 11:44:26 +0200 Subject: [PATCH 4/5] fix: deployment image name --- .github/workflows/deploy.yml | 2 +- DockerFile | 11 ++++++++--- Dockerfile | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 458051b..842d893 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,7 +7,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: sanalyz-api + IMAGE_NAME: MSPRProject/sanalyz-api jobs: build-and-push-images: diff --git a/DockerFile b/DockerFile index f776373..8b4ffd6 100644 --- a/DockerFile +++ b/DockerFile @@ -1,5 +1,10 @@ -FROM maven:3.9-eclipse-temurin-21 AS builder +FROM maven:3.9.6-eclipse-temurin-21 + WORKDIR /app -COPY . . + +COPY pom.xml . +COPY src ./src + EXPOSE 8080 -CMD ["mvn", "spring-boot:run"] \ No newline at end of file + +CMD ["mvn", "spring-boot:run", "-Dspring-boot.run.arguments=--server.address=0.0.0.0"] diff --git a/Dockerfile b/Dockerfile index fbb5bd1..8b4ffd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,4 +7,4 @@ COPY src ./src EXPOSE 8080 -CMD ["mvn", "spring-boot:run", "-Dspring-boot.run.arguments=--server.address=0.0.0.0"] \ No newline at end of file +CMD ["mvn", "spring-boot:run", "-Dspring-boot.run.arguments=--server.address=0.0.0.0"] From 93c42fcf18680b4663fd996ce7c1515d19405e3a Mon Sep 17 00:00:00 2001 From: 0Killian <49152982+0Killian@users.noreply.github.com> Date: Tue, 8 Jul 2025 11:45:30 +0200 Subject: [PATCH 5/5] Update Dockerfile --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6f382a4..8b4ffd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,3 @@ COPY src ./src EXPOSE 8080 CMD ["mvn", "spring-boot:run", "-Dspring-boot.run.arguments=--server.address=0.0.0.0"] -CMD ["mvn", "spring-boot:run", "-Dspring-boot.run.arguments=--server.address=0.0.0.0"]