# version: '3.7'

# services:
#   backend:
#     volumes:
#       - static:/static
#     env_file:
#       - .env
#     build:
#       context: ./django_api_kwara
#     ports:
#       - "8000:8000"
#   frontend:
#     build:
#       context: ./kenya-bankers-portal
#     volumes:
#       - frontend:/app/build
#   nginx:
#     build:
#       context: ./nginx
#     volumes:
#       - static:/static
#       - frontend:/var/www/frontend
#     ports:
#       - "80:80"
#     depends_on:
#       - backend
#       - frontend

# volumes:
#   static:
#   frontend:

# version: '3.7'

services:
  backend:
    build:
      context: ./django_api_kwara
    env_file:
      - .env
    volumes:
      - static:/app/static
      - ./django_api_kwara/db.sqlite3:/app/db.sqlite3  # Persist SQLite database
    ports:
      - "8000:8000"
    command: gunicorn django_api_kwara.wsgi:application --bind 0.0.0.0:8000

  frontend:
    build:
      context: ./kenya-bankers-portal
    # volumes:
      # - frontend:/app/dist
      # - frontend:/app/build
    ports:
      - "8085:80"  # Expose port for the frontend dev server
      # - "5173:5173"  # Expose port for the frontend dev server
    # command: npm run dev

  nginx:
    build:
      context: ./nginx
    volumes:
      - static:/static
      - frontend:/var/www/frontend
    ports:
      - "80:80"
    depends_on:
      - backend
      - frontend

volumes:
  static:
  frontend: