version: '3.9'

services:

  web:
    build: ./docker/web
    container_name: bytecenter_web
    ports:
      - "8080:80"
    volumes:
      - ./public:/var/www/html
      - ./app:/var/www/app
      - ./.env:/var/www/.env
      - ./database.sql:/var/www/database
    depends_on:
      - db
    networks:
      - bytecenter_net

  db:
    image: postgres:16
    container_name: bytecenter_db
    environment:
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: ${DB_NAME}
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    networks:
      - bytecenter_net

  cloudbeaver:
    image: dbeaver/cloudbeaver:latest
    container_name: bytecenter_cloudbeaver
    ports:
      - "8978:8978"
    volumes:
      - cloudbeaver_data:/opt/cloudbeaver/workspace
    depends_on:
      - db
    networks:
      - bytecenter_net

volumes:
  postgres_data:
  cloudbeaver_data:

networks:
  bytecenter_net: