version: '3.7'

services:
    database:
        build: ./neo4j
        environment:
            - NEO4J_AUTH=neo4j/test
        ports:
            - "7474:7474"
            - "7687:7687"
        volumes:
            - ./neo4j/import:/var/lib/neo4j/import
            - ./neo4j/data:/var/lib/neo4j/data
    redis:
        image: "redis:alpine"
        ports:
            - "6379:6379"
    redis-client:
        build: ./redis
        depends_on:
            -   redis
    sg-backend:
        build: ./sg-backend
        command: sh -c "/wait && uvicorn main:app --reload --host 0.0.0.0"
        environment:
            - FRONTEND_URL="http://localhost"
            - NEO4J_URI=neo4j://database:7687
            - NEO4J_USER=neo4j
            - NEO4J_PASSWORD=test
            - WAIT_HOSTS=database:7474
            - WAIT_HOSTS_TIMEOUT=300
            - WAIT_SLEEP_INTERVAL=10
            - WAIT_HOST_CONNECT_TIMEOUT=30
        depends_on:
            - database
            - redis
        ports:
            - "8000:8000"