version: "2"

services:
  db:
    image: mysql:5.6
    container_name: db
    command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
    environment:
      MYSQL_ROOT_PASSWORD: ""
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
      MYSQL_USER: "discov001"
      MYSQL_PASSWORD: "password"
      MYSQL_DATABASE: "discovery"
  es:
    image: elasticsearch:1.5.2
    container_name: es
  memcached:
    image: memcached:1.4.24
    container_name: memcached
  discovery:
    # Uncomment this line to use the official course-discovery base image
    image: edxops/discovery:latest

    # Uncomment the next two lines to build from a local configuration repo
    # build: ../configuration/docker/build/discovery/

    container_name: discovery
    volumes:
      - ..:/edx/app/discovery/discovery
      - /edx/app/discovery/discovery/node_modules
      - ../course_discovery/media:/edx/var/discovery/media
      - ../course_discovery/assets:/edx/var/discovery/staticfiles
    command: tail -f /dev/null
    depends_on:
      - "db"
      - "es"
      - "memcached"
    environment:
      CACHE_BACKEND: "django.core.cache.backends.memcached.MemcachedCache"
      CACHE_LOCATION: "memcached:11211"
      CONN_MAX_AGE: 60
      DB_ENGINE: "django.db.backends.mysql"
      DB_HOST: "db"
      DB_NAME: "discovery"
      DB_PASSWORD: "password"
      DB_PORT: "3306"
      DB_USER: "discov001"
      DJANGO_SETTINGS_MODULE: "course_discovery.settings.test"
      ENABLE_DJANGO_TOOLBAR: 1
      TEST_ELASTICSEARCH_URL: "http://es:9200"
