version: '2'

services:

  frontend:
    build: frontend
    ports:
      - 20080:80
    volumes:
      # Re-use local composer cache via host-volume
      - ~/.composer-docker/cache:/root/.composer/cache:delegated
      # Mount source-code for development
      - ./:/app

  backend:
    build: backend
    ports:
      - 21080:80
    volumes:
      # Re-use local composer cache via host-volume
      - ~/.composer-docker/cache:/root/.composer/cache:delegated
      # Mount source-code for development
      - ./:/app 

  api:
    build: api
    ports:
      - 22080:80
    volumes:
      # Re-use local composer cache via host-volume
      - ~/.composer-docker/cache:/root/.composer/cache:delegated
      # Mount source-code for development
      - ./:/app

  db:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=verysecret
      - MYSQL_DATABASE=yii2advanced
      - MYSQL_USER=yii2advanced
      - MYSQL_PASSWORD=secret

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - '22090:80'
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=mysql
    depends_on:
      - db
 

  #pgsql:
  #  image: postgres:9.5
  #  environment:
  #    - POSTGRES_DB=yii2advanced
  #    - POSTGRES_USER=yii2advanced
  #    - POSTGRES_PASSWORD=secret