services:
  unidad-app:
    build:
      context: .
      dockerfile: Dockerfile
    image: unidad-app
    container_name: unidad-app
    restart: unless-stopped
    tty: true
    environment:
      SERVICE_NAME: app
      SERVICE_TAGS: dev
    working_dir: /var/www
    volumes:
      - ./:/var/www
      - ./.docker/php/php.ini:/usr/local/etc/php/conf.d/local.ini
    networks:
      - unidad-network

  unidad-web:
    image: nginx:alpine
    container_name: unidad-web
    restart: unless-stopped
    tty: true
    ports:
      - "8010:80"
    volumes:
      - ./:/var/www
      - ./.docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
    networks:
      - unidad-network

  unidad-db:
    image: mysql:8.0
    container_name: unidad-db
    restart: unless-stopped
    tty: true
    ports:
      - "3306:3306"
    environment:
      MYSQL_DATABASE: unidad
      MYSQL_ROOT_PASSWORD: root
      MYSQL_PASSWORD: root
      MYSQL_USER: user
    volumes:
      - unidad-dbdata:/var/lib/mysql
    networks:
      - unidad-network

  unidad-pma:
    image: phpmyadmin:latest
    container_name: unidad-pma
    restart: unless-stopped
    ports:
      - "8011:80"
    environment:
      - PMA_HOST=unidad-db
      - PMA_USER=root
      - PMA_PASSWORD=root
    networks:
      - unidad-network

networks:
  unidad-network:
    driver: bridge

volumes:
  unidad-dbdata:
    driver: local
