diff --git a/Dockerfile.one b/Dockerfile.one new file mode 100644 index 000000000..d13af5e99 --- /dev/null +++ b/Dockerfile.one @@ -0,0 +1,11 @@ +FROM eclipse-temurin + +WORKDIR /app + +COPY /target /app + +EXPOSE 8080 + +ENTRYPOINT ["java", "-jar", "spring-petclinic-4.0.3-SNAPSHOT.jar"] + + diff --git a/Dockerfile.two b/Dockerfile.two new file mode 100644 index 000000000..295456ea3 --- /dev/null +++ b/Dockerfile.two @@ -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"] + + diff --git a/my-docker-compose.yml b/my-docker-compose.yml new file mode 100644 index 000000000..b572363d4 --- /dev/null +++ b/my-docker-compose.yml @@ -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: +