feat: improve docker compose file

This commit is contained in:
Ricardo Campos
2024-09-24 12:07:37 -03:00
parent a89585f9f3
commit 218478f208
2 changed files with 10 additions and 11 deletions
+9 -10
View File
@@ -20,17 +20,17 @@ services:
retries: 3
start_period: 10s
java-api:
container_name: java-api
server:
container_name: server
depends_on:
postgres:
db:
condition: service_started
environment:
POSTGRES_DB: tasknote
POSTGRES_HOST: postgres
POSTGRES_HOST: db
POSTGRES_USER: tasknoteuser
POSTGRES_PASSWORD: default
POSTGRES_PORT: 5432
POSTGRES_PORT: 5435
ports:
- "8585:8585"
- "5005:5005"
@@ -47,20 +47,19 @@ services:
retries: 3
start_period: 10s
postgres:
container_name: postgres
db:
container_name: db
image: postgres:15.8-bookworm
environment:
POSTGRES_DB: tasknote
POSTGRES_HOST: postgres
POSTGRES_USER: tasknoteuser
POSTGRES_PASSWORD: default
POSTGRES_PORT: 5432
POSTGRES_PORT: 5435
PGDATA: /tmp
volumes:
- "./data:/tmp"
ports:
- "5432:5432"
- "5435:5432"
healthcheck:
test: psql -q -U $${POSTGRES_USER} -d $${POSTGRES_DB} -c 'SELECT 1'
interval: 1m30s
@@ -7,7 +7,7 @@ management.endpoint.health.show-details=always
# Database, datasource and JPA
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://${POSTGRES_HOST:localhost}:5432/${POSTGRES_DB:tasknote}
spring.datasource.url=jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5435}/${POSTGRES_DB:tasknote}
spring.datasource.username=${POSTGRES_USER:tasknoteuser}
spring.datasource.password=${POSTGRES_PASSWORD:default}
spring.jpa.properties.hibernate.default_schema=tasknote