version: '3.8'
services:
  db:
    image: postgres:15
    container_name: tigaagro_db
    restart: always
    environment:
      POSTGRES_USER: admin
      POSTGRES_PASSWORD: TigaPassword123!
      POSTGRES_DB: tigaagro_db
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data

  backend:
    build: ./backend
    container_name: tigaagro_backend
    restart: always
    ports:
      - "8000:8000"
    depends_on:
      db:
        condition: service_started
    environment:
      DATABASE_URL: postgresql://admin:TigaPassword123!@db:5432/tigaagro_db

  frontend:
    build: ./frontend
    container_name: tigaagro_frontend
    restart: always
    ports:
      - "5050:80"

volumes:
  postgres_data:
