Add docker image build

This commit is contained in:
2025-11-10 15:47:05 +01:00
parent 66609ab25d
commit 7496a77213
4 changed files with 45 additions and 4 deletions

View File

@@ -0,0 +1,13 @@
# Step 1: Use Maven with JDK 21 to build the app
FROM gradle:8.14.3-jdk21-alpine AS builder
WORKDIR /app
COPY build.gradle .
COPY src ./src
RUN gradle clean bootJar -DskipTests
# Step 2: Use lightweight JRE 21 for running the app
FROM eclipse-temurin:21-jre-alpine-3.22
WORKDIR /app
COPY --from=builder /app/build/libs/app-1.0.0.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]

View File

@@ -1,5 +1,9 @@
import org.springframework.boot.gradle.plugin.SpringBootPlugin
plugins {
id 'org.springframework.boot' version '3.5.7'
}
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
@@ -28,11 +32,11 @@ dependencies {
runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.12.6'
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${junitVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.9.3"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.9.3"
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.9.3"
}
test {

View File

@@ -10,7 +10,7 @@ spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.open-in-view=false
spring.data.mongodb.uri=mongodb://root:cms@localhost:27017/prescriptions?authSource=admin
spring.data.mongodb.uri=${SPRING_DATA_MONGODB_URI:mongodb://root:cms@localhost:27017/prescriptions?authSource=admin}
logging.level.org.springframework.jdbc.datasource.init=DEBUG
spring.sql.init.mode=always