# Dosya: docker-compose.yml | Yol: /home/main/public_html/ai.zefre.net/stocksense/docker-compose.yml

version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: stocksense-app
    restart: always
    ports:
      - "3000:3000"
    env_file:
      - .env
    volumes:
      - ./logs:/app/logs
      - ./public/uploads:/app/public/uploads
    depends_on:
      - mongodb
    networks:
      - stocksense-network

  mongodb:
    image: mongo:5.0
    container_name: stocksense-mongodb
    restart: always
    environment:
      - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME:-admin}
      - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD:-stocksensepass}
      - MONGO_INITDB_DATABASE=main_stocksense
    volumes:
      - mongo-data:/data/db
      - ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
    ports:
      - "27017:27017"
    networks:
      - stocksense-network

  nginx:
    image: nginx:alpine
    container_name: stocksense-nginx
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./nginx/conf.d:/etc/nginx/conf.d
      - ./nginx/ssl:/etc/nginx/ssl
      - ./public:/app/public
    depends_on:
      - app
    networks:
      - stocksense-network

networks:
  stocksense-network:
    driver: bridge

volumes:
  mongo-data:



