networks:
  investbrain-network:
    driver: bridge
services:
  app:
    image: investbrainapp/investbrain:latest
    container_name: investbrain-app
    restart: unless-stopped
    tty: true
    expose:
      - "9000"
    volumes:
      - .:/var/www/app:delegated
    depends_on:
      - mysql
      - redis
    networks:
      - investbrain-network
  redis:
    image: redis:alpine
    container_name: investbrain-redis
    restart: unless-stopped
    tty: true
    networks:
      - investbrain-network
    volumes:
      - investbrain-redis:/data
  nginx:
    image: nginx:alpine
    container_name: investbrain-nginx
    restart: unless-stopped
    tty: true
    ports:
      - "${APP_PORT:-8000}:80"
    volumes:
      - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf
      - .:/var/www/app:delegated
    depends_on:
      - app
    networks:
      - investbrain-network
  mysql:
    image: mysql:8.0
    container_name: investbrain-mysql
    restart: unless-stopped
    environment:
      MYSQL_DATABASE: ${DB_DATABASE:-investbrain}
      MYSQL_USER: ${DB_USERNAME:-investbrain}
      MYSQL_PASSWORD: ${DB_PASSWORD:-investbrain}
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-investbrain}
    volumes:
      - ./docker/mysql.conf:/etc/mysql/conf.d/my.cnf
      - investbrain-mysql:/var/lib/mysql
    networks:
      - investbrain-network
volumes:
  investbrain-redis:
  investbrain-mysql:
