version: "3"
name: transporte

services:

  app:
    image: python:3.11-alpine
    depends_on:
      - db
    environment:
      - PORT=4000
      - DBHOST=db
      # - DBHOST=192.168.1.5
      # - DBPORT=5436
      - DBNAME=database
      - DBSCHEMA=desarrollo1
      - DBUSER=postgres
      - DBPASS=password
      - SECRET_JWT="kf6Jc!f30Z!1k1N0#!%#"
    ports:
      - 4000:4000
    volumes:
      - ../:/app
      - venv:/root/.local
    working_dir: /app
    command: sh /app/docker/start.sh

  # REF: https://github.com/postgis/docker-postgis/tree/master/14-3.3
  db:
    image: postgres:14-alpine-geometry
    build:
      context: ./postgres-geometry
      dockerfile: Dockerfile
    volumes:
      - db:/var/lib/postgresql/data
      - ./backups:/docker-entrypoint-initdb.d
      #- ./01_create_tables.sql:/docker-entrypoint-initdb.d/01_create_tables.sql
    ports:
      - 5436:5432
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_DB: database
      PGDATA: /var/lib/postgresql/data/pgdata

  adminer:
    image: adminer
    ports:
      - 8080:8080
    environment:
      ADMINER_DEFAULT_SERVER: db
      ADMINER_DEFAULT_USER: postgres
      ADMINER_DEFAULT_PASSWORD: password
      ADMINER_DESIGN: lucas-sandery

volumes:
  db:
  venv:
