version: '3'

services:
  postgres:
    image: postgres:14-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:
    command: /entrypoint.sh
    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_PORT=5000"
      - "FUNKWHALE_FRONT_IP=host.docker.internal"
      - "FUNKWHALE_FRONT_PORT=8080"
      - "FUNKWHALE_HOSTNAME=${FUNKWHALE_HOSTNAME-host.docker.internal}"
    volumes:
      - ../data/media:/protected/media:ro
      - ../data/music:/music:ro
      - ../data/staticfiles:/staticfiles:ro
      - ../deploy/funkwhale_proxy.conf:/etc/nginx/funkwhale_proxy.conf:ro
      - ../docker/nginx/conf.dev:/etc/nginx/nginx.conf.template:ro
      - ../docker/nginx/entrypoint.sh:/entrypoint.sh:ro
      - ../front:/frontend:ro