version: '2'

services:
    proxy:
        build:
            context: ./docker/nginx 
        depends_on:
            - api
        ports: 
            - "443:443"
    api:
        build: .
        env_file: ./.env
        depends_on:
            - db
    db:
        ports:
            - "5432:5432"
        build:
            context: ./docker/postgres
        ## Enable 'volumes' section to persist Postgres data
        ## Replace '/your/absolute/path' with the path on the
        ## host system in which you want to persist the data
        # volumes:
        #     - /your/absolute/path:/var/lib/postgresql/data
version: '2'

volumes: 
    # Create a volume in the host system to persist postgres data
    pgdata: {}

services:
    proxy:
        build:
            context: ./docker/nginx 
        depends_on:
            - api
        ports: 
            - "443:443"
    api:
        build: .
        env_file: ./.env
        depends_on:
            - db
    db:
        ports:
            - "5432:5432"
        build:
            context: ./docker/postgres
        volumes:
            # Use the pgdata volume to persist this db
            - pgdata:/var/lib/postgresql/data/pgdata

Fix postgres data persistance volume
Fix postgres data persistance volume
