
services:
  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: discord_db
      POSTGRES_USER: discord_user
      POSTGRES_PASSWORD: discord_pass
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U discord_user -d discord_db"]
      interval: 5s
      timeout: 5s
      retries: 5

  web:
    build: .
    image: gitea.bigoscloud.com/biggy/django-discord:latest
    ports:
      - "8000:8000"
    environment:
      SECRET_KEY: "poc-secret-key-not-for-production"
      DEBUG: "True"
      DB_NAME: discord_db
      DB_USER: discord_user
      DB_PASSWORD: discord_pass
      DB_HOST: db
      DB_PORT: "5432"
    volumes:
      - ./media:/app/media
      - ./static:/app/static
    depends_on:
      db:
        condition: service_healthy

volumes:
  pgdata:
