Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can β€” learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company πŸ‘‡

2.0 KB
Raw Blame
# =============================================================================
# AngelaMos | 2026
# dev.compose.yml
# =============================================================================
# Development compose - Nginx + Vite HMR + FastAPI with hot reload
# =============================================================================

name: ${APP_NAME:-c2-beacon}-dev

services:
  nginx:
    image: nginx:1.27-alpine
    container_name: ${APP_NAME:-c2-beacon}-nginx-dev
    ports:
      - "${NGINX_HOST_PORT:-47430}:80"
    volumes:
      - ./infra/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
      - ./infra/nginx/dev.nginx:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      backend:
        condition: service_healthy
      frontend:
        condition: service_started
    networks:
      - frontend
      - backend
    restart: unless-stopped

  frontend:
    build:
      context: ./frontend
      dockerfile: ../infra/docker/vite.dev
    container_name: ${APP_NAME:-c2-beacon}-frontend-dev
    ports:
      - "${FRONTEND_HOST_PORT:-47432}:5173"
    volumes:
      - ./frontend:/app
      - frontend_modules:/app/node_modules
    environment:
      - VITE_API_URL=${VITE_API_URL:-/api}
      - VITE_APP_TITLE=${VITE_APP_TITLE:-C2 Beacon Server}
    networks:
      - frontend
    restart: unless-stopped

  backend:
    build:
      context: ./backend
      dockerfile: ../infra/docker/fastapi.dev
    container_name: ${APP_NAME:-c2-beacon}-backend-dev
    ports:
      - "${BACKEND_HOST_PORT:-47431}:8000"
    volumes:
      - ./backend:/app
      - backend_cache:/app/.venv
    env_file:
      - .env
    environment:
      - ENVIRONMENT=development
      - DEBUG=true
      - RELOAD=true
    networks:
      - backend
    healthcheck:
      test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s
    restart: unless-stopped

networks:
  frontend:
    driver: bridge
  backend:
    driver: bridge

volumes:
  backend_cache:
  frontend_modules: