version: '3'
services:
  web:
    build: .
    ports:
      - "5000:80"
    environment:
      - PHP_SHORT_OPEN_TAG=On
      - APACHE_ERRORLOG=/dev/stderr
      - LOCALDB_USER=cservice
      - LOCALDB_PASS=cservice
      - LOCALDB_HOST=db
      - REMOTEDB_NAME=cservice
      - REMOTEDB_USER=cservice
      - REMOTEDB_PASS=cservice
      - REMOTEDB_HOST=db
      - ENABLE_REGISTER_GLOBALS=1
      - LOG_LEVEL=Logger::DEBUG
      - LOG_STREAM_HANDLER=php://stdout
      - SMTPHOST=mailhog:1025
    volumes:
      - ./:/app
    depends_on:
      - db
      - mailhog

  mailhog:
    image: "mailhog/mailhog"
    ports:
      - "1025:1025"
      - "8025:8025"

  db:
    image: postgres:11-alpine
    restart: always
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data
      - ./dbinit:/docker-entrypoint-initdb.d
      - ./:/app
    environment:
      - POSTGRES_USER=cservice
      - POSTGRES_PASSWORD=cservice
      - POSTGRES_INITDB_ARGS="-E SQL_ASCII"
      - LANG=C

volumes:
  pgdata:
