This commit is contained in:
xDepcio 2024-11-27 17:48:17 +01:00
parent 317562a170
commit a11c9c0a1a
4 changed files with 57 additions and 19 deletions

12
Dockerfile Normal file
View file

@ -0,0 +1,12 @@
FROM maven:3.8.7-openjdk-18-slim AS build
RUN mkdir /app
COPY . /app
WORKDIR /app
RUN mvn package
# Minimal rintime image - only JRE
# FROM gcr.io/distroless/java21-debian12 AS runtime
# COPY --from=build /app/target/*.jar /app.jar
ENTRYPOINT [ "java" ]
CMD [ "-jar", "-Dspring.profiles.active=postgres", "/app.jar" ]

4
Dockerfile-og Normal file
View file

@ -0,0 +1,4 @@
FROM eclipse-temurin:21-jre-alpine
COPY ./target/spring-petclinic-3.3.0-SNAPSHOT.jar /app.jar
CMD ["java", "-jar", "app.jar"]

25
docker-compose-og.yml Normal file
View file

@ -0,0 +1,25 @@
services:
mysql:
image: mysql:9.1
ports:
- "3306:3306"
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"
profiles:
- mysql
postgres:
image: postgres:17.0
ports:
- "5432:5432"
environment:
- POSTGRES_PASSWORD=petclinic
- POSTGRES_USER=petclinic
- POSTGRES_DB=petclinic
profiles:
- postgres

View file

@ -1,25 +1,22 @@
services: services:
mysql: server:
image: mysql:9.1 build:
context: .
ports: ports:
- "3306:3306" - 8080:8080
environment: environment:
- MYSQL_ROOT_PASSWORD= - POSTGRES_URL=jdbc:postgresql://db:5432/petclinic
- MYSQL_ALLOW_EMPTY_PASSWORD=true command: ["-jar", "-Dspring.profiles.active=postgres", "/app.jar"]
- MYSQL_USER=petclinic db:
- MYSQL_PASSWORD=petclinic image: postgres:17.1
- MYSQL_DATABASE=petclinic restart: always
volumes: volumes:
- "./conf.d:/etc/mysql/conf.d:ro" - db-data:/var/lib/postgresql/data
profiles:
- mysql
postgres:
image: postgres:17.0
ports:
- "5432:5432"
environment: environment:
- POSTGRES_PASSWORD=petclinic
- POSTGRES_USER=petclinic
- POSTGRES_DB=petclinic - POSTGRES_DB=petclinic
profiles: - POSTGRES_USER=petclinic
- postgres - POSTGRES_PASSWORD=petclinic
ports:
- 5432:5432
volumes:
db-data: