services:
  redis:
    image: redis:7.4.2-alpine
    expose:
      - 6379
    volumes:
      - ./redis/redis.conf:/usr/local/etc/redis/redis.conf
    command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
  web:
    build:
      # Use the repository root as the build context so files like requirements.txt
      # (located at the repo root) are available during image build. The Dockerfile
      # lives at rad/Dockerfile inside the context.
      context: ..
      dockerfile: rad/Dockerfile
    command: python manage.py runserver 0.0.0.0:8000
    #command: pip install -r requirements.txt
    volumes:
      # Mount the repository root into the container WORKDIR so manage.py and
      # requirements.txt are available at build/run time. This mirrors working
      # in the project root inside the container for development.
      - ../:/usr/src/app
      # (Optional) keep explicit mounts for media/static/backups if you need
      # to override them separately; otherwise they are covered by the repo mount.
      - ../backups:/usr/src/app/backups
      - ../media:/usr/src/app/media
      - ../static:/usr/src/app/static
    ports:
      - 8000:8000
      - 3459:3459
    env_file:
      - ./.env.dev.local
  db:
    image: postgres:14.2-alpine
    volumes:
      - postgres_data:/var/lib/postgresql/data/
    environment:
      - POSTGRES_USER=django
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=rad
  pgadmin:
    image: dpage/pgadmin4:7.2
    environment:
      - PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL:-admin@local}
      - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD:-admin}
    ports:
      - 8080:80
    volumes:
      - pgadmin_data:/var/lib/pgadmin
  cache:
    image: memcached
    ports: 
      - 11211:11211

volumes:
  postgres_data:
    name: docker_postgres_data
  pgadmin_data:
    name: docker_pgadmin_data