version: '3.9'

services:
  db:
    container_name: db 
    image: postgres:13-alpine
    restart: always
    env_file:
      - ./src/.env.dev
    ports:
      - "5432:5432"
    volumes:
      - postgres-data:/var/lib/postgresql/data
    networks:
      - usevoice_network

  app:
    container_name: app
    build:
      context: .
      dockerfile: Dockerfile
      target: dev
    env_file:
      - ./src/.env.dev
    restart: always
    depends_on:
      - db 
    volumes:
      - ./src:/app
    ports:
      - "8025:8000"    
    # Attach the service to a custom network
    networks:
      - usevoice_network
 
          


  # redis:
  #   container_name: redis # Docker conainer name
  #   image: redis:6-alpine

  # worker:

  #   container_name: celery
  #   build:
  #     context: .
  #     dockerfile: Dockerfile
  #     target: dev
      
  #   # volumes:
  #   #   - ./src:/app
  #   env_file:
  #     - ./src/.env.dev
  #   # restart: always
  #   command: start-celery-worker.sh
  #   depends_on:
  #     - app
  #     - redis
  
  # nginx:
  #   build: ./nginx
    
  #   ports:
  #     - "8001:80"
  #   depends_on:
  #     - app

# Define a custom network for services to communicate with each other
networks:
  usevoice_network:
    # Use the bridge driver for the network
    driver: bridge    

volumes:
  postgres-data: 
