version: "3.7"

services:
  bot:
    restart: unless-stopped
    build: .
    depends_on:
      - db
    environment:
      - POSTGRES_DB
      - POSTGRES_HOST=db
      - POSTGRES_PASSWORD
      - POSTGRES_PORT
      - POSTGRES_USER
      - DISCORD_CLIENT_ID
      - DISCORD_SECRET
      - DISCORD_BOT_TOKEN

  db:
    restart: unless-stopped
    image: postgres:11.2-alpine
    environment:
      - POSTGRES_DB
      - POSTGRES_PASSWORD
      - POSTGRES_USER
    ports:
      - ${POSTGRES_PORT}:5432
    volumes:
      - postgres-persisted-volume:/var/lib/postgresql/data

volumes:
  postgres-persisted-volume:
