services:
    api:
        build:
            context: api
        ports:
            - "5000"
        environment:
            - POSTGRES_PASSWORD=password
            - POSTGRES_USER=postgres
            - POSTGRES_DB=flask
            - PYTHONBUFFERED=0
    react:
        build:
            context: react
        ports:
            - "3000"
        environment:
            - WDS_SOCKET_PORT=0
        volumes:
            - ./react/app:/app:z
            # - ./docker_cache/node_modules:/app/node_modules
    nginx:
        image: nginx:1.23.4
        volumes:
            - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
            - ./static:/static
        depends_on:
            - api
        ports:
            - "80:80"
    postgres:
        image: postgres:15.1
        restart: always
        volumes:
            - ./postgres_data:/var/lib/postgresql/data/
        environment:
            POSTGRES_USER: user
            POSTGRES_PASSWORD: password
            POSTGRES_DB: db
