version: "3.7"

services:
  db:
    # We use a mariadb image which supports both amd64 & arm64 architecture
    image: mariadb:10.6.4-focal
    # If you really want to use MySQL, uncomment the following line
    #image: mysql:8.0.27
    command: '--default-authentication-plugin=mysql_native_password'
    volumes:
      - db_data:/var/lib/mysql
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=iri
      - MYSQL_DATABASE=wordpress_ec
      - MYSQL_USER=iri
      - MYSQL_PASSWORD=iri
    expose:
      - 3306
      - 33060
  fpm:
    build:
      dockerfile: fpm.Dockerfile
    volumes:
      - ${PWD}:/var/www/html
    restart: unless-stopped
    environment:
      - WORDPRESS_DB_HOST=db
      - WORDPRESS_DB_USER=iri
      - WORDPRESS_DB_PASSWORD=iri
      - WORDPRESS_DB_NAME=wordpress_ec

  wpcli:
    image: wordpress:cli
    volumes:
      - ${PWD}:/var/www/html
    environment:
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: iri
      WORDPRESS_DB_PASSWORD: iri
      WORDPRESS_DB_NAME: wordpress_ec
    profiles:
      - dev

  web:
    image: caddy:latest
    restart: unless-stopped
    ports:
        - "8080:8080"
    volumes:
      - caddy_data:/data
      - ${PWD}:/var/www/html
      - ${PWD}/Caddyfile:/etc/caddy/Caddyfile

volumes:
  db_data:
  caddy_data: