version: '3.8'

services:
  app:
    build: ./crypto-api
    ports:
      - "8000:80"
    environment:
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=crypto_api
      - DB_USERNAME=postgres
      - DB_PASSWORD=password
    depends_on:
      - postgres

  postgres:
    image: postgres:15
    environment:
      - POSTGRES_DB=crypto_api
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=password
    volumes:
      - postgres_data:/var/lib/postgresql/data
    ports:
      - "5432:5432"

volumes:
  postgres_data:
