diff --git a/.env.example b/.env.example
new file mode 100644
index 000000000..a66fd09c5
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,6 @@
+MYSQL_DATABASE=db_name
+MYSQL_USER=db_user
+MYSQL_PASSWORD=db_password
+MYSQL_ROOT_PASSWORD=root_password
+
+SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/db_name
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 76cb65ff3..ea43e68f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,3 +46,4 @@ out/
_site/
*.css
!petclinic.css
+.env
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..25e21ee30
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,17 @@
+# STAGE 1: Build
+FROM gradle:8.14.2-jdk17 AS builder
+
+WORKDIR /build
+COPY . .
+RUN gradle clean build -x test
+
+RUN cp /build/target/spring-petclinic-*.jar /build/app.jar
+
+# STAGE 2: Runtime
+FROM eclipse-temurin:17-jre-jammy
+
+WORKDIR /app
+COPY --from=builder /build/app.jar app.jar
+
+EXPOSE 8080
+ENTRYPOINT ["java", "-jar", "app.jar"]
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index b2313a1e6..7c9cf849c 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,21 +1,28 @@
services:
- mysql:
- image: mysql:9.5
- ports:
- - "3306:3306"
+ db:
+ image: mysql:8.0
+ container_name: petclinic-db
environment:
- - MYSQL_ROOT_PASSWORD=
- - MYSQL_ALLOW_EMPTY_PASSWORD=true
- - MYSQL_USER=petclinic
- - MYSQL_PASSWORD=petclinic
- - MYSQL_DATABASE=petclinic
- volumes:
- - "./conf.d:/etc/mysql/conf.d:ro"
- postgres:
- image: postgres:18.1
+ MYSQL_DATABASE: ${MYSQL_DATABASE}
+ MYSQL_USER: ${MYSQL_USER}
+ MYSQL_PASSWORD: ${MYSQL_PASSWORD}
+ MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
+ healthcheck:
+ test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ app:
+ build: .
+ container_name: petclinic-app
ports:
- - "5432:5432"
+ - "9090:8080"
environment:
- - POSTGRES_PASSWORD=petclinic
- - POSTGRES_USER=petclinic
- - POSTGRES_DB=petclinic
+ SPRING_PROFILES_ACTIVE: mysql
+ SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
+ SPRING_DATASOURCE_USERNAME: ${MYSQL_USER}
+ SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD}
+ depends_on:
+ db:
+ condition: service_healthy
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index fb38cc3db..24b6c6619 100644
--- a/pom.xml
+++ b/pom.xml
@@ -8,7 +8,7 @@
org.springframework.samples
spring-petclinic
- 4.0.0-SNAPSHOT
+ 5.1.0-SNAPSHOT
petclinic
@@ -17,7 +17,7 @@
UTF-8
UTF-8
- 2024-11-28T14:37:52Z
+ 2025-12-27T19:05:33Z
1.1.2
@@ -39,6 +39,12 @@
https://www.apache.org/licenses/LICENSE-2.0
+
+ scm:git:https://github.com/anna-ishkhanyan/spring-petclinic.git
+ scm:git:git@github.com:anna-ishkhanyan/spring-petclinic.git
+ https://github.com/anna-ishkhanyan/spring-petclinic
+ HEAD
+
@@ -370,7 +376,7 @@
-
+
@@ -383,7 +389,7 @@
-
+
@@ -396,7 +402,7 @@
-
+