← back to Sdcc Awards

cypressaward/docker-compose.yml

162 lines

version: '3.8'

services:
  postgres:
    image: pgvector/pgvector:pg15
    container_name: cypres-postgres
    environment:
      POSTGRES_DB: cypres
      POSTGRES_USER: cypres_user
      POSTGRES_PASSWORD: ${DB_PASSWORD:-secure_password_here}
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./database/schema.sql:/docker-entrypoint-initdb.d/01-schema.sql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U cypres_user"]
      interval: 10s
      timeout: 5s
      retries: 5

  redis:
    image: redis:7-alpine
    container_name: cypres-redis
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    command: redis-server --appendonly yes
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 10s
      timeout: 5s
      retries: 5

  opensearch:
    image: opensearchproject/opensearch:2.11.0
    container_name: cypres-opensearch
    environment:
      - discovery.type=single-node
      - OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m
      - DISABLE_SECURITY_PLUGIN=true
    ports:
      - "9200:9200"
      - "9600:9600"
    volumes:
      - opensearch_data:/usr/share/opensearch/data
    healthcheck:
      test: ["CMD-SHELL", "curl -f http://localhost:9200/_cluster/health || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 5

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: cypres-backend
    environment:
      NODE_ENV: ${NODE_ENV:-development}
      PORT: 3001
      DATABASE_URL: postgresql://cypres_user:${DB_PASSWORD:-secure_password_here}@postgres:5432/cypres
      REDIS_URL: redis://redis:6379
      OPENSEARCH_URL: http://opensearch:9200
      JWT_SECRET: ${JWT_SECRET:-your_jwt_secret_here}
      OPENAI_API_KEY: ${OPENAI_API_KEY}
      AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
      AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
      AWS_REGION: ${AWS_REGION:-us-east-1}
      FRONTEND_URL: ${FRONTEND_URL:-http://localhost:3000}
    ports:
      - "3001:3001"
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
      opensearch:
        condition: service_healthy
    volumes:
      - ./backend:/app
      - /app/node_modules
    command: npm run start:dev

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: cypres-frontend
    environment:
      NEXT_PUBLIC_API_URL: ${API_URL:-http://localhost:3001}
      NEXTAUTH_URL: ${NEXTAUTH_URL:-http://localhost:3000}
      NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-your_nextauth_secret_here}
    ports:
      - "3000:3000"
    depends_on:
      - backend
    volumes:
      - ./frontend:/app
      - /app/node_modules
      - /app/.next
    command: npm run dev

  crawler:
    build:
      context: ./crawler
      dockerfile: Dockerfile
    container_name: cypres-crawler
    environment:
      NODE_ENV: ${NODE_ENV:-development}
      DATABASE_URL: postgresql://cypres_user:${DB_PASSWORD:-secure_password_here}@postgres:5432/cypres
      REDIS_URL: redis://redis:6379
      OPENAI_API_KEY: ${OPENAI_API_KEY}
      CRAWL_RATE_LIMIT: ${CRAWL_RATE_LIMIT:-2}
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy
    volumes:
      - ./crawler:/app
      - /app/node_modules
      - crawler_cache:/app/.cache
    command: npm run dev

  # Development tools
  pgadmin:
    image: dpage/pgadmin4:latest
    container_name: cypres-pgadmin
    environment:
      PGADMIN_DEFAULT_EMAIL: ${PGADMIN_EMAIL:-admin@cypres.org}
      PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_PASSWORD:-admin}
      PGADMIN_CONFIG_SERVER_MODE: 'False'
    ports:
      - "5050:80"
    depends_on:
      - postgres
    profiles:
      - dev

  opensearch-dashboards:
    image: opensearchproject/opensearch-dashboards:2.11.0
    container_name: cypres-opensearch-dashboards
    ports:
      - "5601:5601"
    environment:
      OPENSEARCH_HOSTS: '["http://opensearch:9200"]'
      DISABLE_SECURITY_DASHBOARDS_PLUGIN: 'true'
    depends_on:
      - opensearch
    profiles:
      - dev

volumes:
  postgres_data:
  redis_data:
  opensearch_data:
  crawler_cache:

networks:
  default:
    name: cypres-network