
version: '3.8'
services:
  # backend:
  #   build:
  #     context: ./backend
  #     dockerfile: Dockerfile
  #   container_name: backend
  #   expose:
  #     - "8000"
  #   restart: always

  # frontend:
  #   build:
  #     context: ./frontend
  #     dockerfile: Dockerfile
  #   container_name: frontend
  #   expose:
  #     - "3000"
  #   environment:
  #     - NODE_ENV=production
  #   restart: always
  #   networks:
  #     - sta_network

  # nginx:
  #   image: nginx:latest
  #   container_name: nginx
  #   ports:
  #     - "80:80"
  #   volumes:
  #     - ./nginx/sta_test.conf:/etc/nginx/conf.d/sta_test.conf:ro
  #   depends_on:
  #     - backend
  #     - frontend
  #   restart: always
  #   networks:
  #     - sta_network


  # backend:
  #   build: 
  #     context: ./backend
  #     dockerfile: Dockerfile
  #   container_name: backend
  #   ports:
  #     - "8000:8000"
  #   expose:
  #     - "8000"
  #   environment:
  #     - DEBUG=1
  #     - DATABASE_URL=postgresql+asyncpg://postgres:postgres@localhost:5433/sta
  #     - IS_DOCKER=1
  #   depends_on:
  #     postgres:
  #       condition: service_healthy
  #     redis:
  #       condition: service_healthy
  #   networks:
  #     - sta_network
  #   # dns:
  #   #   - 8.8.8.8
  #   #   - 8.8.4.4
  #   # dns_opt:
  #   #   - ndots:1
  #   #   - timeout:3
  #   #   - attempts:5
  #   # sysctls:
  #   #   - net.ipv4.tcp_keepalive_time=60
  #   #   - net.ipv4.tcp_keepalive_intvl=10
  #   #   - net.ipv4.tcp_keepalive_probes=6

  postgres:
    image: postgres:15
    environment:
      POSTGRES_DB: shop_db
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    ports:
      - "5434:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5


  # redis:
  #   image: redis:7
  #   ports:
  #     - "6380:6379"
  #   healthcheck:
  #     test: ["CMD", "redis-cli", "ping"]
  #     interval: 5s
  #     timeout: 5s
  #     retries: 5
  #   networks:
  #     - sta_network

  # elasticsearch:
  #   image: elasticsearch:8.17.2
  #   environment:
  #     - discovery.type=single-node
  #     - xpack.security.enabled=false
  #     - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
  #   ports:
  #     - "9200:9200"
  #   volumes:
  #     - elasticsearch_data:/usr/share/elasticsearch/data
  #   healthcheck:
  #     test: ["CMD", "curl", "-f", "http://localhost:9200"]
  #     interval: 10s
  #     timeout: 5s
  #     retries: 5
  #   networks:
  #     - sta_network

# networks:
#   sta_network:
#     name: sta_network
#     driver: bridge

volumes:
  postgres_data:
    driver: local
  # elasticsearch_data:
  #   driver: local