version: "3.3"
    
services:

  docksible_db:
    image: mysql:8.3
    container_name: docksible_db
    volumes:
      - "$HOME/docksible-volumes/db_data:/var/lib/mysql"
    restart: unless-stopped
    environment:
      - "MYSQL_ROOT_PASSWORD={{ database_root_password }}"
      - "MYSQL_USER={{ database_username }}"
      - "MYSQL_PASSWORD={{ database_password }}"
      - "MYSQL_DATABASE={{ database_name }}"
    command: '--default-authentication-plugin=mysql_native_password'
    
  docksible_wordpress:
    depends_on:
      - docksible_db
    container_name: docksible_wordpress
    image: wordpress:latest
    restart: unless-stopped
    environment:
      - "WORDPRESS_DB_HOST=docksible_db:3306"
      - "WORDPRESS_DB_USER={{ database_username }}"
      - "WORDPRESS_DB_PASSWORD={{ database_password }}"
      - "WORDPRESS_DB_NAME={{ database_name }}"
{% for item in wordpress_auth_vars|dict2items %}
      - "{{ item.key }}={{ item.value }}"
{% endfor %}
    volumes:
      - "$HOME/dawn_docker_volumes/wordpress_data:/var/www/html"
  
  docksible_webserver:
    image: nginx:latest
    container_name: docksible_webserver
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "$HOME/docksible-volumes/nginx_data:/etc/nginx/conf.d"
      - "$HOME/docksible-volumes/wordpress_data:/var/www/html"

  docksible_phpmyadmin:
    depends_on:
      - docksible_db
    image: phpmyadmin
    container_name: docksible_phpmyadmin
    restart: unless-stopped
    environment:
      - "PMA_HOST=docksible_db"

  docksible_ssh-proxy:
    build: "$HOME/ssh-proxy"
    ports:
            - "2222:22"
    volumes:
            - "$HOME/docksible-volumes/ssh-proxy_data:/home/proxy_user/.ssh"
    restart: always
    container_name: docksible_ssh-proxy
