version: "3"

services:

  # --- MariaDB
  db:
    image: docker.io/library/mariadb:11.2
    restart: unless-stopped
    command: mariadbd --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: docker.io/linkace/linkace:latest
    restart: unless-stopped
    depends_on:
      - db
    volumes:
      - ./.env:/app/.env
      - ./backups:/app/storage/app/backups
      - linkace_app:/app
      - linkace_logs:/app/storage/logs

  # --- nginx
  nginx:
    image: docker.io/bitnami/nginx:1.24
    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: docker.io/bitnami/redis:7.2
    restart: unless-stopped
    environment:
      - REDIS_PASSWORD=${REDIS_PASSWORD}

volumes:
  linkace_app:
  linkace_logs:
  db:
    driver: local
