mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-17 05:15:50 +00:00
feat: add docker containarization files
This commit is contained in:
parent
5c24fcf6a4
commit
5ccc487ba9
3 changed files with 52 additions and 0 deletions
11
Dockerfile.one
Normal file
11
Dockerfile.one
Normal file
|
@ -0,0 +1,11 @@
|
|||
FROM eclipse-temurin
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY /target /app
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["java", "-jar", "spring-petclinic-4.0.3-SNAPSHOT.jar"]
|
||||
|
||||
|
19
Dockerfile.two
Normal file
19
Dockerfile.two
Normal file
|
@ -0,0 +1,19 @@
|
|||
FROM maven AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN ["mvn", "clean", "install"]
|
||||
|
||||
FROM eclipse-temurin
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/target/spring-petclinic-*.jar app.jar
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
ENTRYPOINT ["java","-jar","app.jar"]
|
||||
|
||||
|
22
my-docker-compose.yml
Normal file
22
my-docker-compose.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
services:
|
||||
petclinic:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.two
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
postgres:
|
||||
image: postgres:alpine
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=petclinic
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
|
Loading…
Reference in a new issue