mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2026-02-04 21:31:11 +00:00
Merge fb1870c4c6 into ab1d5364a0
This commit is contained in:
commit
a2026e5cd5
5 changed files with 59 additions and 22 deletions
6
.env.example
Normal file
6
.env.example
Normal file
|
|
@ -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
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -46,3 +46,4 @@ out/
|
|||
_site/
|
||||
*.css
|
||||
!petclinic.css
|
||||
.env
|
||||
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
|
@ -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"]
|
||||
|
|
@ -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
|
||||
16
pom.xml
16
pom.xml
|
|
@ -8,7 +8,7 @@
|
|||
</parent>
|
||||
<groupId>org.springframework.samples</groupId>
|
||||
<artifactId>spring-petclinic</artifactId>
|
||||
<version>4.0.0-SNAPSHOT</version>
|
||||
<version>5.1.0-SNAPSHOT</version>
|
||||
<name>petclinic</name>
|
||||
|
||||
<properties>
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<!-- Important for reproducible builds. Update using e.g. ./mvnw versions:set -DnewVersion=... -->
|
||||
<project.build.outputTimestamp>2024-11-28T14:37:52Z</project.build.outputTimestamp>
|
||||
<project.build.outputTimestamp>2025-12-27T19:05:33Z</project.build.outputTimestamp>
|
||||
|
||||
<!-- Web dependencies -->
|
||||
<webjars-locator.version>1.1.2</webjars-locator.version>
|
||||
|
|
@ -39,6 +39,12 @@
|
|||
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<connection>scm:git:https://github.com/anna-ishkhanyan/spring-petclinic.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:anna-ishkhanyan/spring-petclinic.git</developerConnection>
|
||||
<url>https://github.com/anna-ishkhanyan/spring-petclinic</url>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring and Spring Boot dependencies -->
|
||||
|
|
@ -370,7 +376,7 @@
|
|||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
<ignore />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
<pluginExecution>
|
||||
|
|
@ -383,7 +389,7 @@
|
|||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
<ignore />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
<pluginExecution>
|
||||
|
|
@ -396,7 +402,7 @@
|
|||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
<ignore />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue