version: "3"

services:

  # --- MariaDB
  db:
    image: mariadb:10.7
    restart: unless-stopped
    command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
    environment:
      - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
      - MYSQL_USER=${DB_USERNAME}
      - MYSQL_PASSWORD=${DB_PASSWORD}
      - MYSQL_DATABASE=${DB_DATABASE}
    volumes:
      - db:/var/lib/mysql

  # --- LinkAce Image with PHP
  app:
    image: linkace/linkace:latest
    restart: unless-stopped
    depends_on:
      - db
    volumes:
      - ./.env:/app/.env
      - linkace_app:/app
      - linkace_logs:/app/storage/logs
      # Remove the hash of the following line if you want to use local backups
      #- ./backups:/app/storage/app/backups

  # --- nginx
  nginx:
    image: bitnami/nginx:1.21
    restart: unless-stopped
    ports:
      - "0.0.0.0:80:8080"
      #- "0.0.0.0:443:8443"
    depends_on:
      - app
    volumes:
      - linkace_app:/app
      # Replace `nginx.conf` with `nginx-ssl.conf` and remove the hash from the following line
      # if you want to use HTTPS for this container
      - ./nginx.conf:/opt/bitnami/nginx/conf/server_blocks/linkace.conf:ro
      #- /path/to/your/ssl/certificates:/certs:ro

  # --- Redis
  redis:
    image: bitnami/redis:6.2
    restart: unless-stopped
    environment:
      - REDIS_PASSWORD=${REDIS_PASSWORD}

volumes:
  linkace_app:
  linkace_logs:
  db:
    driver: local
