Docker compose assesment

This commit is contained in:
JustFiesta 2024-04-17 13:38:59 +02:00
parent d0728a3ebd
commit 909dea471b
2 changed files with 24 additions and 28 deletions

View file

@ -18,4 +18,4 @@ WORKDIR /app
COPY --from=build /project/target/spring-petclinic-${app_version}.jar /app/java-application.jar
ENTRYPOINT ["java", "-jar", "java-application.jar"]
ENTRYPOINT [ "java", "-Dspring.profiles.active=postgres", "-jar", "java-application.jar"]

View file

@ -20,30 +20,26 @@ services:
# database data between container restarts. The `db-password` secret is used
# to set the database password. You must create `db/password.txt` and add
# a password of your choosing to it before running `docker-compose up`.
# depends_on:
# db:
# condition: service_healthy
# db:
# image: postgres
# restart: always
# user: postgres
# secrets:
# - db-password
# volumes:
# - db-data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=example
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
# expose:
# - 5432
# healthcheck:
# test: [ "CMD", "pg_isready" ]
# interval: 10s
# timeout: 5s
# retries: 5
# volumes:
# db-data:
# secrets:
# db-password:
# file: db/password.txt
depends_on:
db:
condition: service_healthy
environment:
- POSTGRES_URL=jdbc:postgresql://db:5432/petclinic
db:
image: postgres
restart: always
volumes:
- db-data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=petclinic
- POSTGRES_USER=petclinic
- POSTGRES_PASSWORD=petclinic
ports:
- 5432:5432
healthcheck:
test: [ "CMD", "pg_isready", "-U", "petclinic" ]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data: