version: "3.9"

services:
  postgres:
    image: postgres:16
    environment:
      POSTGRES_DB: didactopus
      POSTGRES_USER: didactopus
      POSTGRES_PASSWORD: didactopus-dev-password
    ports:
      - "5432:5432"
    volumes:
      - ./ops/postgres-data:/var/lib/postgresql/data

  api:
    build: .
    command: didactopus-api
    environment:
      DIDACTOPUS_DATABASE_URL: postgresql+psycopg://didactopus:didactopus-dev-password@postgres:5432/didactopus
      DIDACTOPUS_JWT_SECRET: change-me
    ports:
      - "8011:8011"
    depends_on:
      - postgres
    volumes:
      - ./:/app

  worker:
    build: .
    command: didactopus-worker
    environment:
      DIDACTOPUS_DATABASE_URL: postgresql+psycopg://didactopus:didactopus-dev-password@postgres:5432/didactopus
      DIDACTOPUS_JWT_SECRET: change-me
    depends_on:
      - postgres
    volumes:
      - ./:/app
