services:
    movieservice:
        image: movieservice-img
        build:
            context: .
            dockerfile: movieservice/Dockerfile
        ports:
            - "5001:5001"
        networks:
            - microservices-net #allows communication to all services on this network, ie, to stservice
#next let us make it such that we can edit the movie service and change it on the fly
        environment:
            FLASK_ENV: development #set flask env so that it reloads when source code changes
        volumes:
            - .:/src
        # The above mapping should correspond to where py files are copied over in movieservice/Dockerfile
        # Now, when the source code changes in host, it is reflected in the "/" working dir of the container
        # This change is detected by Flask and reloads the movie service
        # Note that this reloading does NOT happen for stservice below as it lacks this config!
    stservice:
        image: stservice-img
        build:
            context: .
            dockerfile: stservice/Dockerfile
        ports:
            - "5002:5002"
        networks:
            - microservices-net #allows communication to all services on this network, ie to movieservice

networks:
    # The presence of this object is sufficient to define it
    microservices-net: {}
