version: '3.8' services: # PostgreSQL Database postgres: image: postgres:15-alpine container_name: konturai-postgres environment: POSTGRES_DB: konturai POSTGRES_USER: postgres POSTGRES_PASSWORD: password ports: - '5432:5432' volumes: - postgres_data:/var/lib/postgresql/data - ./src/main/resources/db/migration:/docker-entrypoint-initdb.d networks: - konturai-network healthcheck: test: ['CMD-SHELL', 'pg_isready -U postgres -d konturai'] interval: 10s timeout: 5s retries: 5 # MongoDB Database mongodb: image: mongo:7.0 container_name: konturai-mongodb environment: MONGO_INITDB_ROOT_USERNAME: konturai MONGO_INITDB_ROOT_PASSWORD: konturai2024 MONGO_INITDB_DATABASE: konturai ports: - '27017:27017' volumes: - mongodb_data:/data/db networks: - konturai-network healthcheck: test: ['CMD', 'mongosh', '--eval', 'db.adminCommand("ping")'] interval: 10s timeout: 5s retries: 5 # Spring Boot Application app: build: context: . dockerfile: Dockerfile container_name: konturai-app environment: SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/konturai POSTGRES_USER: postgres POSTGRES_PASSWORD: password SPRING_JPA_HIBERNATE_DDL_AUTO: none MONGODB_URI: mongodb://konturai:konturai2024@mongodb:27017/konturai?authSource=admin MONGODB_DATABASE: konturai ports: - '8080:8080' depends_on: postgres: condition: service_healthy mongodb: condition: service_healthy networks: - konturai-network healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:8080/actuator/health'] interval: 30s timeout: 10s retries: 3 start_period: 60s volumes: postgres_data: mongodb_data: networks: konturai-network: driver: bridge