services:
  php:
    container_name: emna-php
    build: .
    ports:
      - 8181:80
    links:
      - db:db
    depends_on:
      - db
    volumes:
      - ./src:/var/www/html:rw,cached
    user: "${USER_ID}:${GROUP_ID}"
    environment:
      - PS_DEV_MODE=1
      - DB_SERVER=db
      - DB_USER=root
      - DB_PASSWD=root
      - DB_NAME=emma-db
      - PS_INSTALL_AUTO=0
      #- PS_DOMAIN=localhost:80
    networks:
      net:
        ipv4_address: 172.30.30.10

  db:
    container_name: emna-mysql
    image: mysql:5.7
    ports:
      - "3306:3306"
    environment:
      MYSQL_USER: user
      MYSQL_PASSWORD: pass
      MYSQL_ROOT_PASSWORD: rootpass
      MYSQL_DATABASE: emma-db
    volumes:
      - ./docker/.data:/var/lib/mysql
    networks:
      net:
        ipv4_address: 172.30.30.20

  phpmyadmin:
    container_name: emna-phpmyadmin
    image: phpmyadmin/phpmyadmin:4.6.3-1
    links:
      - db
    depends_on:
      - db
    environment:
      PMA_HOST: db
      PMA_PORT: 3306
      PMA_ARBITRARY: 1
      PMA_USER: root
      PMA_PASSWORD: rootpass
    restart: always
    ports:
      - 8000:80
    networks:
      net:
        ipv4_address: 172.30.30.30

networks:
  net:
    driver: bridge
    ipam:
      config:
        - subnet: 172.30.30.0/24
