version: '3'
services:
  mariadb:
    image: mariadb:11.2.2
    container_name: d7_api_mariadb
    ports:
      - 3306:3306
    volumes:
      - ../_shared/mysql/conf.d:/etc/mysql/conf.d
      - ~/volumes/mariadb:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MARIADB_PASSWORD}
      MYSQL_DATABASE: dev_drupal7_eclipse_api
  www:
    build:
      context: ../php/
      dockerfile: Dockerfile.php5.5
    image: php55
    container_name: d7_api_www
    ports:
      - 80
    volumes:
      - ./www:/var/www/html
      - ./monitor:/home/data/common/monitor
      - $SSH_AUTH_SOCK:$SSH_AUTH_SOCK
    environment:
      SSH_AUTH_SOCK: $SSH_AUTH_SOCK
      VIRTUAL_HOST: 'accounts.eclipse.dev.docker,api.eclipse.dev.docker'
      CERT_NAME: dev.docker
      MYSQL_PASSWORD: ${MARIADB_PASSWORD}
      MYSQL_USER: ${MARIADB_USERNAME}
      LDAP_HOST: ${EWT_LDAP_HOST}
      RECAPTCHA_PUBKEY: ${EWT_RECAPTCHA_PUBKEY}
      RECAPTCHA_PRIVKEY: ${EWT_RECAPTCHA_PRIVKEY}
      RECAPTCHA_MAILHIDE_PUBKEY: ${EWT_RECAPTCHA_MAILHIDE_PUBKEY}
      RECAPTCHA_MAILHIDE_PRIVKEY: ${EWT_RECAPTCHA_MAILHIDE_PRIVKEY}
  keycloak:
    image: services-keycloak
    build:
      context: ../../projects-services/keycloak
    container_name: services-keycloak-accounts-d7
    command:
      - start-dev
      - --import-realm
      - --proxy=edge
    ports:
      - 8080:8080
    environment:
      - KEYCLOAK_ADMIN=${KEYCLOAK_USER}
      - KEYCLOAK_ADMIN_PASSWORD=${KEYCLOAK_PASSWORD}
      - DB_VENDOR=POSTGRES
      - DB_ADDR=postgres
      - DB_PORT=5432
      - DB_DATABASE=${KEYCLOAK_DB}
      - DB_USER=${KEYCLOAK_DB_USER}
      - DB_PASSWORD=${KEYCLOAK_DB_PASS}
      - VIRTUAL_HOST=keycloak
      - CERT_NAME=dev.docker
      - VIRTUAL_PORT=8080
    depends_on:
      - postgres
      - nginx-proxy
    restart: unless-stopped
    volumes:
      - ./realm-export:/opt/keycloak/data/import
  postgres:
    image: postgres:latest
    container_name: services-postgres-accounts-d7
    environment:
      - POSTGRES_DB=${KEYCLOAK_DB}
      - POSTGRES_USER=${KEYCLOAK_DB_USER}
      - POSTGRES_PASSWORD=${KEYCLOAK_DB_PASS}
    ports:
      - 5432
    restart: unless-stopped
  nginx-proxy:
    image: jwilder/nginx-proxy
    container_name: d7_api_proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      - ../_shared/certs:/etc/nginx/certs
      - ../_shared/nginx/webdev-nginx.conf:/etc/nginx/conf.d/webdev-nginx.conf
