version: "3.7"
services:
  app:
    image: kooldev/php:7.4-nginx
    ports:
      - ${KOOL_APP_PORT:-80}:80
    environment:
      ASUSER: ${KOOL_ASUSER:-0}
      UID: ${UID:-0}
    volumes:
      - .:/app:delegated
      - $HOME/.ssh:/home/kool/.ssh:delegated
    networks:
      - kool_local
      - kool_global
  database:
    image: mysql:8.0.22
    command: --default-authentication-plugin=mysql_native_password
    ports:
      - ${KOOL_DATABASE_PORT:-3306}:3306
    environment:
      MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-rootpass}
      MYSQL_DATABASE: ${DB_DATABASE:-database}
      MYSQL_USER: ${DB_USERNAME:-user}
      MYSQL_PASSWORD: ${DB_PASSWORD:-pass}
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
    volumes:
      - database:/var/lib/mysql:delegated
    networks:
      - kool_local
  cache:
    image: redis:6-alpine
    volumes:
      - cache:/data:delegated
    networks:
      - kool_local
volumes:
  database: null
  cache: null
networks:
  kool_local: null
  kool_global:
    external: true
    name: ${KOOL_GLOBAL_NETWORK:-kool_global}
