services:
  bloonsworld:
    container_name: bloonsworld
    build: ./app
    volumes:
      - ./.data/media:/home/app/web/media:rw
      - ./.data/static:/home/app/web/static:rw
    command:
      - sh
      - -c
      - |
        gunicorn --chdir /home/app/web --bind :80 --worker-class gevent --workers 3 settings.wsgi:application
    environment:
      - DJANGO_SECRET_KEY
      - DJANGO_ALLOWED_HOSTS
      - DJANGO_DEBUG
      - SQL_ENGINE
      - SQL_DATABASE
      - SQL_USER
      - SQL_PASSWORD
      - SQL_HOST
      - SQL_PORT
    networks:
      - bloonsworld
    depends_on:
      - bloonsworld-db
    ports:
      - 80:80
    restart: unless-stopped

  bloonsworld-db:
    container_name: bloonsworld-db
    image: postgres:17
    volumes:
      - ./.data/postgres_data:/var/lib/postgresql/data/:rw
    environment:
      - POSTGRES_USER=$SQL_USER
      - POSTGRES_PASSWORD=$SQL_PASSWORD
      - POSTGRES_DB=$SQL_DATABASE
    networks:
      - bloonsworld
    restart: unless-stopped

networks:
  bloonsworld: