version: '3'

services:
  db:
    image: postgres:16
    volumes:
      - "./data/db/pgdata:/var/lib/postgresql/data/"
    env_file:
      - ./.env
    restart: always
    networks:
      - internal
  pgadmin:
    image: dpage/pgadmin4
    volumes:
      - "./data/dbadmin:/var/lib/pgadmin"
    env_file:
      - ./.env
    expose:
      - 5050
    restart: always
    networks:
      - internal
    depends_on:
      - db
  flask:
    build:
      context: ./flask
      dockerfile: Dockerfile
    command: gunicorn --bind 0.0.0.0:5000 manage:app
    expose:
      - 5000
    env_file:
      - ./.env
    networks:
      - internal 
    depends_on:
      - db
  osmtile:
    image: overv/openstreetmap-tile-server:2.3.0
    hostname: osmtile
    environment:
      - "DOWNLOAD_PBF=https://download.geofabrik.de/europe/bulgaria-latest.osm.pbf"
      - "DOWNLOAD_POLY=https://download.geofabrik.de/europe/bulgaria.poly"
    volumes:
      - "./data/osmtile:/data/database/"
    command: "run"
    #command: "import"
    expose:
      - 8000
    networks:
      - internal
    restart: always
networks:
  internal: {} 
