services:
  server:
    build:
      context: .
      dockerfile: docker/server/server.dockerfile
    environment:
      - DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@db:5432/platform
      - LDT_SECRET=${LDT_SECRET}
      - DEBUG=${DEBUG}
    depends_on:
      db:
        condition: service_healthy
    volumes:
      - ./data/static/site:/static/site
      - ./data/static/media:/iridata/www/ldt/web/static/media

  db:
    image: postgres
    volumes:
      - ./data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=platform
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
    healthcheck:
      test: [ "CMD", "pg_isready", "-U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5

  es:
    image: launcher.gcr.io/google/elasticsearch2
    user: "101:101"
    volumes:
      - ./data/es:/usr/share/elasticsearch/data

  caddy:
    build:
      context: docker/web
      dockerfile: web.dockerfile
    volumes:
      - ./data/static:/static
    ports:
      - "80:80"
      - "443:443"

  cache:
    image: docker.io/memcached:alpine
