version: '3'

services:
  postgres:
    image: postgres:15-alpine
    environment:
      - 'POSTGRES_HOST_AUTH_METHOD=trust'
    volumes:
      - '../data/postgres:/var/lib/postgresql/data'
    ports:
      - 5432:5432

  redis:
    image: redis:7-alpine
    volumes:
      - '../data/redis:/data'
    ports:
      - 6379:6379

  nginx:
    env_file:
      - ./.env
    image: nginx
    ports:
      - 8000:80
    extra_hosts:
      - host.docker.internal:host-gateway
    environment:
      - 'NGINX_MAX_BODY_SIZE=100M'
      - 'FUNKWHALE_API_IP=host.docker.internal'
      - 'FUNKWHALE_API_HOST=host.docker.internal'
      - 'FUNKWHALE_API_PORT=5000'
      - 'FUNKWHALE_FRONT_IP=host.docker.internal'
      - 'FUNKWHALE_FRONT_PORT=8080'
      - 'FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME-host.docker.internal}'
      - 'FUNKWHALE_PROTOCOL=https'
    volumes:
      - ../data/media:/workspace/funkwhale/data/media:ro
      - ../data/music:/music:ro
      - ../data/staticfiles:/usr/share/nginx/html/staticfiles/:ro
      - ../deploy/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro
      - ../docker/nginx/conf.dev:/etc/nginx/templates/default.conf.template:ro
      - ../front:/frontend:ro
