---
name: linkace_dev
services:

  # --- MariaDB
  db:
    image: docker.io/library/mariadb:12.0
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
      - MYSQL_USER=${DB_USERNAME}
      - MYSQL_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=${DB_DATABASE}
    ports:
      - "127.0.0.1:3306:3306"
    volumes:
      - linkace-db:/var/lib/mysql

  pg-db:
    image: docker.io/library/postgres:17
    environment:
      - POSTGRES_PASSWORD=${DB_PASSWORD}
      - POSTGRES_USER=${DB_USERNAME}
      - POSTGRES_DB=${DB_DATABASE}
    ports:
      - "127.0.0.1:5432:5432"
    volumes:
      - linkace-pg-db:/var/lib/postgresql/data

  # --- PHP
  php:
    build:
      context: .
      dockerfile: ./resources/docker/dockerfiles/development.Dockerfile
    depends_on:
      - db
    volumes:
      - .:/app:delegated
      - ./resources/docker/php/php-dev.ini:/usr/local/etc/php/conf.d/php.ini:ro

  # --- Caddy
  caddy:
    image: docker.io/library/caddy:2
    ports:
      - "80:80"
    depends_on:
      - php
    volumes:
      - .:/app:delegated
      - ./resources/docker/Caddyfile:/etc/caddy/Caddyfile:ro

  # --- Redis
  redis:
    image: docker.io/library/redis:8.2
    command: "redis-server --requirepass ${REDIS_PASSWORD}"
    ports:
      - "127.0.0.1:6379:6379"

  # --- Buggregator
  buggregator:
    image: ghcr.io/buggregator/server:latest
    ports:
      - "8000:8000"
    depends_on:
      - php

volumes:
  linkace-db:
    driver: local
  linkace-pg-db:
    driver: local
