version: "3.4"

services:
  wp-gica:
    image: wordpress:latest
    depends_on:
      db-gica:
        condition: service_healthy
    ports:
      - "8007:80"
    environment:
      WORDPRESS_DB_HOST: db-gica
      WORDPRESS_DB_USER: gicausernaffco
      WORDPRESS_DB_PASSWORD: gicaNaffcoPass@#123
      WORDPRESS_DB_NAME: naffcogica
    volumes:
      - ./php-gica.ini:/usr/local/etc/php/conf.d/uploads.ini
      - data_gica:/var/www/html
    networks:
      - gica_network
    restart: always

  db-gica:
    image: mysql:5.7
    volumes:
      - db_data_gica:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: gicaNaffcoPass@#123
      MYSQL_DATABASE: naffcogica
      MYSQL_USER: gicausernaffco
      MYSQL_PASSWORD: gicaNaffcoPass@#123
    ports:
      - "3314:3306"
    networks:
      - gica_network
    restart: always
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
      interval: 30s
      timeout: 10s
      retries: 5

volumes:
  data_gica:
  db_data_gica:

networks:
  gica_network:
    external: true
