#version: '3.8'
services:
  builder:
    build:
      context: .
      target: builder
    depends_on:
      - postgres

  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: spring-boot-app
    environment:
      - SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/yaka_save
      - SPRING_DATASOURCE_USERNAME=myuser
      - SPRING_DATASOURCE_PASSWORD=secret
    ports:
      - "8084:9595"
    depends_on:
      - postgres

  postgres:
    image: postgres:15-alpine
    container_name: postgres-db
    environment:
      POSTGRES_DB: yaka_save
      POSTGRES_USER: myuser
      POSTGRES_PASSWORD: secret
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5433:5432"

volumes:
  postgres_data:
